auto import from //depot/cupcake/@132589
The Android Open Source Project [Tue, 3 Mar 2009 22:04:30 +0000 (14:04 -0800)]
62 files changed:
AndroidManifest.xml
res/drawable/app_icon_blank.png [new file with mode: 0644]
res/drawable/bg_calendar.9.png [new file with mode: 0644]
res/drawable/bg_calendar_primary.9.png [new file with mode: 0644]
res/drawable/ic_date_01.png [new file with mode: 0644]
res/drawable/ic_date_02.png [new file with mode: 0644]
res/drawable/ic_date_03.png [new file with mode: 0644]
res/drawable/ic_date_04.png [new file with mode: 0644]
res/drawable/ic_date_05.png [new file with mode: 0644]
res/drawable/ic_date_06.png [new file with mode: 0644]
res/drawable/ic_date_07.png [new file with mode: 0644]
res/drawable/ic_date_08.png [new file with mode: 0644]
res/drawable/ic_date_09.png [new file with mode: 0644]
res/drawable/ic_date_10.png [new file with mode: 0644]
res/drawable/ic_date_11.png [new file with mode: 0644]
res/drawable/ic_date_12.png [new file with mode: 0644]
res/drawable/ic_date_13.png [new file with mode: 0644]
res/drawable/ic_date_14.png [new file with mode: 0644]
res/drawable/ic_date_15.png [new file with mode: 0644]
res/drawable/ic_date_16.png [new file with mode: 0644]
res/drawable/ic_date_17.png [new file with mode: 0644]
res/drawable/ic_date_18.png [new file with mode: 0644]
res/drawable/ic_date_19.png [new file with mode: 0644]
res/drawable/ic_date_20.png [new file with mode: 0644]
res/drawable/ic_date_21.png [new file with mode: 0644]
res/drawable/ic_date_22.png [new file with mode: 0644]
res/drawable/ic_date_23.png [new file with mode: 0644]
res/drawable/ic_date_24.png [new file with mode: 0644]
res/drawable/ic_date_25.png [new file with mode: 0644]
res/drawable/ic_date_26.png [new file with mode: 0644]
res/drawable/ic_date_27.png [new file with mode: 0644]
res/drawable/ic_date_28.png [new file with mode: 0644]
res/drawable/ic_date_29.png [new file with mode: 0644]
res/drawable/ic_date_30.png [new file with mode: 0644]
res/drawable/ic_date_31.png [new file with mode: 0644]
res/drawable/strip_cal_secondary.9.png [new file with mode: 0644]
res/drawable/white_list_rule_cal.9.png [new file with mode: 0644]
res/layout-land/gadget_item.xml [new file with mode: 0644]
res/layout/gadget_item.xml [new file with mode: 0644]
res/values-cs/strings.xml
res/values-de/strings.xml
res/values-es/strings.xml
res/values-fr/arrays.xml
res/values-fr/strings.xml
res/values-it/arrays.xml
res/values-it/strings.xml
res/values-ja/strings.xml
res/values-ko/strings.xml
res/values-nb/strings.xml
res/values-nl/strings.xml
res/values-pl/arrays.xml
res/values-pl/strings.xml
res/values-ru/strings.xml
res/values-zh-rCN/strings.xml
res/values-zh-rTW/strings.xml
res/values/colors.xml
res/values/strings.xml
res/xml/gadget_info.xml [new file with mode: 0644]
src/com/android/calendar/CalendarGadgetProvider.java [new file with mode: 0644]
src/com/android/calendar/CalendarView.java
src/com/android/calendar/SelectCalendarsActivity.java
tests/src/com/android/calendar/FormatDateRangeTest.java

index 9363849..da9daf0 100644 (file)
@@ -52,8 +52,7 @@
         <activity android:name="DayActivity" android:label="@string/day_view"
             android:theme="@android:style/Theme.Light.NoTitleBar" />
         <activity android:name="AgendaActivity" android:label="@string/agenda_view" 
-            android:theme="@android:style/Theme.Light.NoTitleBar"
-            android:exported="true" />
+            android:theme="@android:style/Theme.Light.NoTitleBar" />
         
         <activity android:name="EditEvent" android:label="@string/event_edit_title"
             android:theme="@android:style/Theme.Light"
                  <category android:name="android.intent.category.UNIT_TEST" />
             </intent-filter>
         </activity>
+
+        <receiver android:name="CalendarGadgetProvider">
+            <intent-filter>
+                <action android:name="android.gadget.action.GADGET_UPDATE" />
+                <action android:name="com.android.providers.calendar.EVENTS_CHANGED" />
+            </intent-filter>
+            <meta-data android:name="android.gadget.provider" android:resource="@xml/gadget_info" />
+        </receiver>
     </application>
 </manifest>
 
diff --git a/res/drawable/app_icon_blank.png b/res/drawable/app_icon_blank.png
new file mode 100644 (file)
index 0000000..78e4008
Binary files /dev/null and b/res/drawable/app_icon_blank.png differ
diff --git a/res/drawable/bg_calendar.9.png b/res/drawable/bg_calendar.9.png
new file mode 100644 (file)
index 0000000..7e9c624
Binary files /dev/null and b/res/drawable/bg_calendar.9.png differ
diff --git a/res/drawable/bg_calendar_primary.9.png b/res/drawable/bg_calendar_primary.9.png
new file mode 100644 (file)
index 0000000..8c3a7c7
Binary files /dev/null and b/res/drawable/bg_calendar_primary.9.png differ
diff --git a/res/drawable/ic_date_01.png b/res/drawable/ic_date_01.png
new file mode 100644 (file)
index 0000000..0246742
Binary files /dev/null and b/res/drawable/ic_date_01.png differ
diff --git a/res/drawable/ic_date_02.png b/res/drawable/ic_date_02.png
new file mode 100644 (file)
index 0000000..533668c
Binary files /dev/null and b/res/drawable/ic_date_02.png differ
diff --git a/res/drawable/ic_date_03.png b/res/drawable/ic_date_03.png
new file mode 100644 (file)
index 0000000..7061b4c
Binary files /dev/null and b/res/drawable/ic_date_03.png differ
diff --git a/res/drawable/ic_date_04.png b/res/drawable/ic_date_04.png
new file mode 100644 (file)
index 0000000..fb720d5
Binary files /dev/null and b/res/drawable/ic_date_04.png differ
diff --git a/res/drawable/ic_date_05.png b/res/drawable/ic_date_05.png
new file mode 100644 (file)
index 0000000..207c145
Binary files /dev/null and b/res/drawable/ic_date_05.png differ
diff --git a/res/drawable/ic_date_06.png b/res/drawable/ic_date_06.png
new file mode 100644 (file)
index 0000000..fb0cf1a
Binary files /dev/null and b/res/drawable/ic_date_06.png differ
diff --git a/res/drawable/ic_date_07.png b/res/drawable/ic_date_07.png
new file mode 100644 (file)
index 0000000..5d5545d
Binary files /dev/null and b/res/drawable/ic_date_07.png differ
diff --git a/res/drawable/ic_date_08.png b/res/drawable/ic_date_08.png
new file mode 100644 (file)
index 0000000..98bcb30
Binary files /dev/null and b/res/drawable/ic_date_08.png differ
diff --git a/res/drawable/ic_date_09.png b/res/drawable/ic_date_09.png
new file mode 100644 (file)
index 0000000..1915481
Binary files /dev/null and b/res/drawable/ic_date_09.png differ
diff --git a/res/drawable/ic_date_10.png b/res/drawable/ic_date_10.png
new file mode 100644 (file)
index 0000000..1bd783e
Binary files /dev/null and b/res/drawable/ic_date_10.png differ
diff --git a/res/drawable/ic_date_11.png b/res/drawable/ic_date_11.png
new file mode 100644 (file)
index 0000000..bf6912a
Binary files /dev/null and b/res/drawable/ic_date_11.png differ
diff --git a/res/drawable/ic_date_12.png b/res/drawable/ic_date_12.png
new file mode 100644 (file)
index 0000000..7ffdf5c
Binary files /dev/null and b/res/drawable/ic_date_12.png differ
diff --git a/res/drawable/ic_date_13.png b/res/drawable/ic_date_13.png
new file mode 100644 (file)
index 0000000..fe536f6
Binary files /dev/null and b/res/drawable/ic_date_13.png differ
diff --git a/res/drawable/ic_date_14.png b/res/drawable/ic_date_14.png
new file mode 100644 (file)
index 0000000..328ec99
Binary files /dev/null and b/res/drawable/ic_date_14.png differ
diff --git a/res/drawable/ic_date_15.png b/res/drawable/ic_date_15.png
new file mode 100644 (file)
index 0000000..a0448cf
Binary files /dev/null and b/res/drawable/ic_date_15.png differ
diff --git a/res/drawable/ic_date_16.png b/res/drawable/ic_date_16.png
new file mode 100644 (file)
index 0000000..21f18a2
Binary files /dev/null and b/res/drawable/ic_date_16.png differ
diff --git a/res/drawable/ic_date_17.png b/res/drawable/ic_date_17.png
new file mode 100644 (file)
index 0000000..a02434a
Binary files /dev/null and b/res/drawable/ic_date_17.png differ
diff --git a/res/drawable/ic_date_18.png b/res/drawable/ic_date_18.png
new file mode 100644 (file)
index 0000000..03288f7
Binary files /dev/null and b/res/drawable/ic_date_18.png differ
diff --git a/res/drawable/ic_date_19.png b/res/drawable/ic_date_19.png
new file mode 100644 (file)
index 0000000..d518403
Binary files /dev/null and b/res/drawable/ic_date_19.png differ
diff --git a/res/drawable/ic_date_20.png b/res/drawable/ic_date_20.png
new file mode 100644 (file)
index 0000000..dbe10e0
Binary files /dev/null and b/res/drawable/ic_date_20.png differ
diff --git a/res/drawable/ic_date_21.png b/res/drawable/ic_date_21.png
new file mode 100644 (file)
index 0000000..644d3b9
Binary files /dev/null and b/res/drawable/ic_date_21.png differ
diff --git a/res/drawable/ic_date_22.png b/res/drawable/ic_date_22.png
new file mode 100644 (file)
index 0000000..0924dd3
Binary files /dev/null and b/res/drawable/ic_date_22.png differ
diff --git a/res/drawable/ic_date_23.png b/res/drawable/ic_date_23.png
new file mode 100644 (file)
index 0000000..60d0e0b
Binary files /dev/null and b/res/drawable/ic_date_23.png differ
diff --git a/res/drawable/ic_date_24.png b/res/drawable/ic_date_24.png
new file mode 100644 (file)
index 0000000..eed072a
Binary files /dev/null and b/res/drawable/ic_date_24.png differ
diff --git a/res/drawable/ic_date_25.png b/res/drawable/ic_date_25.png
new file mode 100644 (file)
index 0000000..38af902
Binary files /dev/null and b/res/drawable/ic_date_25.png differ
diff --git a/res/drawable/ic_date_26.png b/res/drawable/ic_date_26.png
new file mode 100644 (file)
index 0000000..84b5319
Binary files /dev/null and b/res/drawable/ic_date_26.png differ
diff --git a/res/drawable/ic_date_27.png b/res/drawable/ic_date_27.png
new file mode 100644 (file)
index 0000000..ad559f5
Binary files /dev/null and b/res/drawable/ic_date_27.png differ
diff --git a/res/drawable/ic_date_28.png b/res/drawable/ic_date_28.png
new file mode 100644 (file)
index 0000000..49355d8
Binary files /dev/null and b/res/drawable/ic_date_28.png differ
diff --git a/res/drawable/ic_date_29.png b/res/drawable/ic_date_29.png
new file mode 100644 (file)
index 0000000..4da387b
Binary files /dev/null and b/res/drawable/ic_date_29.png differ
diff --git a/res/drawable/ic_date_30.png b/res/drawable/ic_date_30.png
new file mode 100644 (file)
index 0000000..91cd2fe
Binary files /dev/null and b/res/drawable/ic_date_30.png differ
diff --git a/res/drawable/ic_date_31.png b/res/drawable/ic_date_31.png
new file mode 100644 (file)
index 0000000..9c094b8
Binary files /dev/null and b/res/drawable/ic_date_31.png differ
diff --git a/res/drawable/strip_cal_secondary.9.png b/res/drawable/strip_cal_secondary.9.png
new file mode 100644 (file)
index 0000000..acddde0
Binary files /dev/null and b/res/drawable/strip_cal_secondary.9.png differ
diff --git a/res/drawable/white_list_rule_cal.9.png b/res/drawable/white_list_rule_cal.9.png
new file mode 100644 (file)
index 0000000..0b175a3
Binary files /dev/null and b/res/drawable/white_list_rule_cal.9.png differ
diff --git a/res/layout-land/gadget_item.xml b/res/layout-land/gadget_item.xml
new file mode 100644 (file)
index 0000000..3fd4415
--- /dev/null
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/gadget"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:paddingBottom="6px"
+    android:background="@drawable/bg_calendar"
+    >
+
+    <TextView
+        android:id="@+id/no_events"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:paddingTop="6px"
+        android:gravity="center"
+        android:textStyle="bold"
+        android:textSize="16sp"
+        android:text="@string/gadget_no_events"
+        android:textColor="@color/gadget_no_events"
+        />
+
+    <FrameLayout
+        android:id="@+id/landscape_hidden"
+        android:layout_width="0dip"
+        android:layout_height="0dip"
+        android:visibility="gone"
+        >
+
+        <TextView
+            android:id="@+id/secondary_card"
+            android:layout_width="0dip"
+            android:layout_height="0dip"
+            />
+
+        <TextView
+            android:id="@+id/stub_when"
+            android:layout_width="0dip"
+            android:layout_height="0dip"
+            />
+
+        <TextView
+            android:id="@+id/stub_title"
+            android:layout_width="0dip"
+            android:layout_height="0dip"
+            />
+
+        <TextView
+            android:id="@+id/stub_where"
+            android:layout_width="0dip"
+            android:layout_height="0dip"
+            />
+
+        <TextView
+            android:id="@+id/secondary_when"
+            android:layout_width="0dip"
+            android:layout_height="0dip"
+            android:background="@drawable/strip_cal_secondary"
+            />
+
+        <TextView
+            android:id="@+id/secondary_title"
+            android:layout_width="0dip"
+            android:layout_height="0dip"
+            />
+
+        <ImageView
+            android:id="@+id/divider"
+            android:layout_width="0dip"
+            android:layout_height="0dip"
+            android:background="@drawable/white_list_rule_cal"
+            />
+
+        <TextView
+            android:id="@+id/title2"
+            android:layout_width="0dip"
+            android:layout_height="0dip"
+            />
+
+    </FrameLayout>
+
+    <LinearLayout
+        android:id="@+id/primary_card"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:paddingLeft="3px"
+        android:paddingRight="3px"
+        android:paddingTop="3px"
+        android:paddingBottom="8px"
+        android:background="@drawable/bg_calendar_primary"
+        android:orientation="vertical"
+        android:visibility="gone"
+        >
+
+        <TextView
+            android:id="@+id/when"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingRight="64px"
+            android:paddingLeft="8px"
+            android:paddingTop="1px"
+            android:paddingBottom="1px"
+            android:gravity="center_vertical"
+            android:background="@drawable/strip_cal"
+            android:textStyle="bold"
+            android:textSize="11sp"
+            android:textColor="@color/gadget_when"
+            android:singleLine="true"
+            />
+
+        <TextView
+            android:id="@+id/title"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingRight="64px"
+            android:paddingLeft="8px"
+            android:textStyle="bold"
+            android:textSize="16sp"
+            android:textColor="@color/gadget_title"
+            android:singleLine="true"
+            />
+
+        <TextView
+            android:id="@+id/where"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingRight="64px"
+            android:paddingLeft="8px"
+            android:textSize="11sp"
+            android:textColor="@color/gadget_where"
+            android:singleLine="true"
+            />
+
+    </LinearLayout>
+
+    <ImageView
+        android:id="@+id/icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentRight="true"
+        android:layout_marginRight="8px"
+        android:src="@drawable/app_icon_blank"
+        android:visibility="gone"
+        />
+
+</RelativeLayout>
+
diff --git a/res/layout/gadget_item.xml b/res/layout/gadget_item.xml
new file mode 100644 (file)
index 0000000..0d4160b
--- /dev/null
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/gadget"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:paddingBottom="6px"
+    android:background="@drawable/bg_calendar"
+    >
+
+    <TextView
+        android:id="@+id/no_events"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:paddingTop="6px"
+        android:gravity="center"
+        android:textStyle="bold"
+        android:textSize="16sp"
+        android:text="@string/gadget_no_events"
+        android:textColor="@color/gadget_no_events"
+        />
+
+    <LinearLayout
+        android:id="@+id/secondary_card"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginLeft="3px"
+        android:layout_marginRight="3px"
+        android:orientation="vertical"
+        android:visibility="gone"
+        >
+
+        <TextView
+            android:id="@+id/stub_when"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:textStyle="bold"
+            android:textSize="11sp"
+            android:paddingTop="8px"
+            android:visibility="invisible"
+            />
+
+        <TextView
+            android:id="@+id/stub_title"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:textStyle="bold"
+            android:textSize="16sp"
+            android:visibility="invisible"
+            />
+
+        <TextView
+            android:id="@+id/stub_where"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:textSize="11sp"
+            android:visibility="invisible"
+            />
+
+        <TextView
+            android:id="@+id/secondary_when"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingLeft="8px"
+            android:paddingTop="1px"
+            android:paddingBottom="1px"
+            android:gravity="center_vertical"
+            android:background="@drawable/strip_cal_secondary"
+            android:textStyle="bold"
+            android:textSize="11sp"
+            android:textColor="@color/gadget_when"
+            android:singleLine="true"
+            />
+
+        <TextView
+            android:id="@+id/secondary_title"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingLeft="8px"
+            android:textSize="11sp"
+            android:textColor="@color/gadget_title"
+            android:singleLine="true"
+            />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/primary_card"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:paddingLeft="3px"
+        android:paddingRight="3px"
+        android:paddingTop="3px"
+        android:paddingBottom="8px"
+        android:background="@drawable/bg_calendar_primary"
+        android:orientation="vertical"
+        android:visibility="gone"
+        >
+
+        <TextView
+            android:id="@+id/when"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingRight="64px"
+            android:paddingLeft="8px"
+            android:paddingTop="1px"
+            android:paddingBottom="1px"
+            android:gravity="center_vertical"
+            android:background="@drawable/strip_cal"
+            android:textStyle="bold"
+            android:textSize="11sp"
+            android:textColor="@color/gadget_when"
+            android:singleLine="true"
+            />
+
+        <TextView
+            android:id="@+id/title"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingRight="64px"
+            android:paddingLeft="8px"
+            android:textStyle="bold"
+            android:textSize="16sp"
+            android:textColor="@color/gadget_title"
+            android:singleLine="true"
+            />
+
+        <TextView
+            android:id="@+id/where"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingRight="64px"
+            android:paddingLeft="8px"
+            android:textSize="11sp"
+            android:textColor="@color/gadget_where"
+            android:singleLine="true"
+            />
+
+        <ImageView
+            android:id="@+id/divider"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="4px"
+            android:layout_marginBottom="2px"
+            android:layout_marginLeft="16px"
+            android:layout_marginRight="16px"
+            android:background="@drawable/white_list_rule_cal"
+            />
+
+        <TextView
+            android:id="@+id/title2"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:paddingRight="64px"
+            android:paddingLeft="8px"
+            android:textStyle="bold"
+            android:textSize="11sp"
+            android:textColor="@color/gadget_title"
+            android:singleLine="true"
+            />
+
+    </LinearLayout>
+
+    <ImageView
+        android:id="@+id/icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentRight="true"
+        android:layout_marginRight="8px"
+        android:src="@drawable/app_icon_blank"
+        android:visibility="gone"
+        />
+
+</RelativeLayout>
+
index 7da9cfc..dc5aab8 100644 (file)
     <string name="preferences_default_reminder_title">"Nastavit výchozí připomenutí"</string>
     <string name="preferences_default_reminder_dialog">"Výchozí čas připomenutí"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"Kalendář:"</string>
+    <string name="gadget_now_event">"Nyní: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"Další: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"Později: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"Jedna další událost"</item>
+    <item quantity="other">"<xliff:g id="NUMBER">%d</xliff:g> dalších událostí"</item>
+  </plurals>
+    <string name="gadget_no_events">"Žádné nadcházející události"</string>
 </resources>
index 152047e..db21ce6 100644 (file)
     <string name="preferences_default_reminder_title">"Standarderinnerung festlegen"</string>
     <string name="preferences_default_reminder_dialog">"Standard-Erinnerungszeit"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"Kalender:"</string>
+    <string name="gadget_now_event">"Jetzt: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"Weiter: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"Später: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"1 weiterer Termin"</item>
+    <item quantity="other">"<xliff:g id="NUMBER">%d</xliff:g> weitere Termine"</item>
+  </plurals>
+    <string name="gadget_no_events">"Keine anstehenden Kalendertermine"</string>
 </resources>
index 1755eb7..0f211d3 100644 (file)
@@ -94,7 +94,7 @@
     <string name="discard_label">"Descartar cambios"</string>
     <string name="import_label">"Importar"</string>
     <string name="snooze_all_label">"Posponer todos"</string>
-    <string name="dismiss_all_label">"Descartar todos"</string>
+    <string name="dismiss_all_label">"Descartar todas"</string>
     <string name="does_not_repeat">"Evento único"</string>
     <string name="daily">"Cada día"</string>
     <string name="every_weekday">"Cada día laboral (lunes-viernes)"</string>
     <string name="preferences_default_reminder_title">"Configurar recordatorio predeterminado"</string>
     <string name="preferences_default_reminder_dialog">"Duración predeterminada del recordatorio"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"Calendario:"</string>
+    <string name="gadget_now_event">"Ahora: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"Siguiente: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"Posterior: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"Un evento más"</item>
+    <item quantity="other">"<xliff:g id="NUMBER">%d</xliff:g> eventos más"</item>
+  </plurals>
+    <string name="gadget_no_events">"No hay próximos eventos en el calendario"</string>
 </resources>
index 62e0448..ef550ec 100644 (file)
     <item>"samedi"</item>
   </string-array>
   <string-array name="ordinal_labels">
-    <item>"1er"</item>
-    <item>"2e"</item>
-    <item>"3e"</item>
-    <item>"4e"</item>
+    <item>"premier"</item>
+    <item>"seconde"</item>
+    <item>"troisième"</item>
+    <item>"quatrième"</item>
     <item>"dernier"</item>
   </string-array>
   <string-array name="response_labels1">
index a1b4517..750a325 100644 (file)
@@ -38,9 +38,9 @@
     <item quantity="one">"1 jour"</item>
     <item quantity="other">"<xliff:g id="COUNT">%d</xliff:g> jours"</item>
   </plurals>
-    <string name="show_agenda_view">"Afficher l\'agenda"</string>
+    <string name="show_agenda_view">"Afficher le planning"</string>
     <string name="show_day_view">"Afficher le jour"</string>
-    <string name="agenda_view">"Mon planning"</string>
+    <string name="agenda_view">"Agenda"</string>
     <string name="day_view">"Jour"</string>
     <string name="week_view">"Semaine"</string>
     <string name="month_view">"Mois"</string>
@@ -75,7 +75,7 @@
     <string name="edit_event_all_day_label">"Journée entière"</string>
     <string name="edit_event_calendar_label">"Agenda"</string>
     <string name="edit_event_show_extra_options">"Afficher les options supplémentaires"</string>
-    <string name="edit_event_hide_extra_options">"Masquer options supplémentaires"</string>
+    <string name="edit_event_hide_extra_options">"Masquer les options supplémentaires"</string>
     <string name="description_label">"Description"</string>
     <string name="presence_label">"Présence"</string>
     <string name="privacy_label">"Confidentialité"</string>
     <string name="delete_label">"Supprimer"</string>
     <string name="delete_event_label">"Supprimer l\'événement"</string>
     <string name="save_label">"Enregistrer"</string>
-    <string name="discard_label">"Ignorer"</string>
+    <string name="discard_label">"Ignorer les modifications"</string>
     <string name="import_label">"Importer"</string>
-    <string name="snooze_all_label">"Tout répéter"</string>
+    <string name="snooze_all_label">"Tout mettre en attente"</string>
     <string name="dismiss_all_label">"Tout supprimer"</string>
     <string name="does_not_repeat">"Événement ponctuel"</string>
-    <string name="daily">"Ignorer"</string>
-    <string name="every_weekday">"Les jours ouvrables (lun–ven)"</string>
+    <string name="daily">"Quotidien"</string>
+    <string name="every_weekday">"Chaque jour de semaine (lun–ven)"</string>
     <string name="weekly">"Hebdomadaire (chaque <xliff:g id="DAYS_OF_WEEK">%s</xliff:g>)"</string>
     <string name="monthly_on_day_count">"Mensuel (chaque <xliff:g id="ORDINAL_NUMBER">%1$s</xliff:g> <xliff:g id="DAY_OF_WEEK">%2$s</xliff:g>)"</string>
     <string name="monthly_on_day">"Mensuel (le <xliff:g id="DAY_OF_MONTH">%s</xliff:g>)"</string>
     <string name="yearly">"Annuel (le <xliff:g id="DATES">%s</xliff:g>)"</string>
-    <string name="custom">"Personnalisé… (non paramétrable sur téléphone)"</string>
+    <string name="custom">"Personnalisé… (paramétrage impossible avec un téléphone)"</string>
     <string name="modify_event">"Modifier uniquement cet événement."</string>
     <string name="modify_all">"Modifier tous les événements de la série."</string>
     <string name="modify_all_following">"Modifier cet événement et tous les suivants."</string>
     <string name="preferences_title">"Paramètres"</string>
     <string name="preferences_general_title">"Paramètre d\'affichage de l\'agenda"</string>
     <string name="preferences_alerts_title">"Paramètres de rappel"</string>
-    <string name="preferences_hide_declined_title">"Masquer évén. refusés"</string>
-    <string name="preferences_alerts_type_title">"Alertes et notifications"</string>
+    <string name="preferences_hide_declined_title">"Masquer les événements refusés"</string>
+    <string name="preferences_alerts_type_title">"Définir les alertes et les notifications"</string>
     <string name="preferences_alerts_type_dialog">"Alertes et notifications"</string>
     <string name="preferences_alerts_vibrate_title">"Vibreur"</string>
     <string name="preferences_alerts_ringtone_title">"Sélectionner la sonnerie"</string>
     <string name="preferences_default_reminder_title">"Définir le rappel par défaut"</string>
     <string name="preferences_default_reminder_dialog">"Intervalle de rappel par défaut"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"Agenda :"</string>
+    <string name="gadget_now_event">"Maintenant : <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"Suivant : <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"Plus tard : <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"1 événement supplémentaire"</item>
+    <item quantity="other">"<xliff:g id="NUMBER">%d</xliff:g> autres événements"</item>
+  </plurals>
+    <string name="gadget_no_events">"Aucun événement d\'agenda à venir"</string>
 </resources>
index 5778f7e..92c7ff4 100644 (file)
@@ -84,7 +84,7 @@
   <string-array name="preferences_alert_type_labels">
     <item>"Avviso"</item>
     <item>"Notifica barra di stato"</item>
-    <item>"Disativa"</item>
+    <item>"Disattivato"</item>
   </string-array>
   <string-array name="preferences_alert_type_values">
     <item>"0"</item>
index 0aaeef5..7236aa6 100644 (file)
@@ -17,9 +17,9 @@
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label">"Calendario"</string>
     <string name="calendar_plug"><font fgcolor="#ffffffff">"Benvenuto in  Google Calendar!"</font>" "\n"Un approccio di Google alla gestione della tua pianificazione in base all\'idea che gli eventi di pianificazione possano essere più intuitivi, efficaci e accessibili."</string>
-    <string name="what_label">"Che cosa"</string>
+    <string name="what_label">"Titolo"</string>
     <string name="when_label">"Intervallo di tempo"</string>
-    <string name="where_label">"Dove"</string>
+    <string name="where_label">"Posizione"</string>
     <string name="repeats_label">"Ripetizione"</string>
     <string name="no_title_label">"(Nessun oggetto)"</string>
   <plurals name="Nminutes">
@@ -64,7 +64,7 @@
     <string name="loading_calendars_title">"Caricamento calendari"</string>
     <string name="loading_calendars_message">"Caricamento calendari in corso..."</string>
     <string name="alert_when_label">"Intervallo di tempo:"</string>
-    <string name="alert_where_label">"Dove:"</string>
+    <string name="alert_where_label">"Posizione:"</string>
     <string name="alert_missed_events_single">"(Altri <xliff:g id="REMINDER_COUNT">%s</xliff:g> promemoria)"</string>
     <string name="alert_missed_events_multiple">"(Altri <xliff:g id="REMINDER_COUNT">%s</xliff:g> promemoria)"</string>
     <string name="event_info_title">"Visualizza evento"</string>
     <string name="dismiss_all_label">"Ignora tutto"</string>
     <string name="does_not_repeat">"Evento occasionale"</string>
     <string name="daily">"Ogni giorno"</string>
-    <string name="every_weekday">"Ogni giorno lavorativo (Lun-Ven)"</string>
+    <string name="every_weekday">"Ogni giorno della settimana (Lun-Ven)"</string>
     <string name="weekly">"Ogni settimana (ogni <xliff:g id="DAYS_OF_WEEK">%s</xliff:g>)"</string>
-    <string name="monthly_on_day_count">"Ogni mese (ogni <xliff:g id="ORDINAL_NUMBER">%1$s</xliff:g> <xliff:g id="DAY_OF_WEEK">%2$s</xliff:g>)"</string>
+    <string name="monthly_on_day_count">"Ogni mese (ogni <xliff:g id="ORDINAL_NUMBER">%1$s</xliff:g><xliff:g id="DAY_OF_WEEK">%2$s</xliff:g>"</string>
     <string name="monthly_on_day">"Ogni mese (il <xliff:g id="DAY_OF_MONTH">%s</xliff:g>)"</string>
-    <string name="yearly">"Ogni anno (il <xliff:g id="DATES">%s</xliff:g>)"</string>
+    <string name="yearly">"Ogni anno (il <xliff:g id="DATES">%s</xliff:g>"</string>
     <string name="custom">"Personalizzato… (impossibile personalizzare sul telefono)"</string>
     <string name="modify_event">"Modifica solo questo evento."</string>
     <string name="modify_all">"Modifica tutti gli eventi nelle serie."</string>
     <string name="preferences_alerts_type_dialog">"Avvisi e notifiche"</string>
     <string name="preferences_alerts_vibrate_title">"Vibrazione"</string>
     <string name="preferences_alerts_ringtone_title">"Seleziona suoneria"</string>
-    <string name="preferences_default_reminder_title">"Promemoria predefinito"</string>
-    <string name="preferences_default_reminder_dialog">"Imposta promemoria predefinito"</string>
+    <string name="preferences_default_reminder_title">"Imposta promemoria predefinito"</string>
+    <string name="preferences_default_reminder_dialog">"Orario promemoria predefinito"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"Calendario:"</string>
+    <string name="gadget_now_event">"Adesso: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"Successivo: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"Successivo: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"1 altro evento"</item>
+    <item quantity="other">"<xliff:g id="NUMBER">%d</xliff:g> altri eventi"</item>
+  </plurals>
+    <string name="gadget_no_events">"Nessun evento di calendario imminente"</string>
 </resources>
index 235f0df..6e43594 100644 (file)
     <string name="preferences_default_reminder_title">"通知設定"</string>
     <string name="preferences_default_reminder_dialog">"デフォルトの通知時間"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"カレンダー:"</string>
+    <string name="gadget_now_event">"現在時刻: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"次へ: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"後で: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"他1件"</item>
+    <item quantity="other">"他<xliff:g id="NUMBER">%d</xliff:g>件"</item>
+  </plurals>
+    <string name="gadget_no_events">"予定されているカレンダーの予定はありません"</string>
 </resources>
index 24a2e64..430d0e0 100644 (file)
     <string name="preferences_default_reminder_title">"기본 알림 설정"</string>
     <string name="preferences_default_reminder_dialog">"기본 알림 시간"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"캘린더:"</string>
+    <string name="gadget_now_event">"현재 시각: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"다음: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"예정 시각: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"1개 일정 더보기"</item>
+    <item quantity="other">"<xliff:g id="NUMBER">%d</xliff:g>개 일정 더보기"</item>
+  </plurals>
+    <string name="gadget_no_events">"예정된 캘린더 일정이 없습니다."</string>
 </resources>
index 3da8d23..ceeee31 100644 (file)
     <string name="preferences_default_reminder_title">"Sett standard påminnelse"</string>
     <string name="preferences_default_reminder_dialog">"Standard påminnelsestid"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"Kalender:"</string>
+    <string name="gadget_now_event">"Nå: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"Neste: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"Senere: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"En hendelse til"</item>
+    <item quantity="other">"<xliff:g id="NUMBER">%d</xliff:g> hendelser til"</item>
+  </plurals>
+    <string name="gadget_no_events">"Ingen kommende kalenderhendelser"</string>
 </resources>
index a3448cb..df05da6 100644 (file)
@@ -16,7 +16,7 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="app_label">"Agenda"</string>
-    <string name="calendar_plug"><font fgcolor="#ffffffff">"Welkom bij Google Agenda!"</font>" "\n" Een Google-benadering om uw planning te beheren, gebaseerd op het idee dat het plannen van afspraken intuïtiever, efficiënter en toegankelijker kan."</string>
+    <string name="calendar_plug"><font fgcolor="#ffffffff">"Welkom bij  Google Agenda!"</font>" "\n" Een Google-benadering om uw planning te beheren, gebaseerd op het idee dat het plannen van afspraken intuïtiever, efficiënter en toegankelijker kan."</string>
     <string name="what_label">"Wat"</string>
     <string name="when_label">"Wanneer"</string>
     <string name="where_label">"Waar"</string>
@@ -45,7 +45,7 @@
     <string name="week_view">"Week"</string>
     <string name="month_view">"Maand"</string>
     <string name="event_view">"Afspraak weergeven"</string>
-    <string name="event_create">"Nieuwe afspraak"</string>
+    <string name="event_create">"Nieuwe  afspraak"</string>
     <string name="event_edit">"Afspraak bewerken"</string>
     <string name="event_delete">"Afspraak verwijderen"</string>
     <string name="goto_today">"Vandaag"</string>
     <string name="preferences_default_reminder_title">"Standaardherinnering instellen"</string>
     <string name="preferences_default_reminder_dialog">"Standaard herinneringstijd"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"Kalender:"</string>
+    <string name="gadget_now_event">"Nu: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"Volgende: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"Later: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"nog 1 gebeurtenis"</item>
+    <item quantity="other">"nog <xliff:g id="NUMBER">%d</xliff:g> gebeurtenissen"</item>
+  </plurals>
+    <string name="gadget_no_events">"Geen geplande afspraken"</string>
 </resources>
index d81349d..1ab3b2e 100644 (file)
     <item>"Publiczny"</item>
   </string-array>
   <string-array name="day_labels">
-    <item>"niedziela"</item>
-    <item>"poniedziałek"</item>
-    <item>"wtorek"</item>
-    <item>"środa"</item>
-    <item>"czwartek"</item>
-    <item>"piątek"</item>
-    <item>"sobota"</item>
+    <item>"Niedziela"</item>
+    <item>"Poniedziałek"</item>
+    <item>"Wtorek"</item>
+    <item>"Środa"</item>
+    <item>"Czwartek"</item>
+    <item>"Piątek"</item>
+    <item>"Sobota"</item>
   </string-array>
   <string-array name="ordinal_labels">
     <item>"1."</item>
index 168d59b..591f7ca 100644 (file)
     <string name="discard_label">"Odrzuć zmiany"</string>
     <string name="import_label">"Importuj"</string>
     <string name="snooze_all_label">"Odłóż wszystkie"</string>
-    <string name="dismiss_all_label">"Zamknij wszystkie"</string>
+    <string name="dismiss_all_label">"Odrzuć wszystkie"</string>
     <string name="does_not_repeat">"Wydarzenie jednorazowe"</string>
     <string name="daily">"Codziennie"</string>
     <string name="every_weekday">"Codziennie (pn-pt)"</string>
     <string name="weekly">"Co tydzień (<xliff:g id="DAYS_OF_WEEK">%s</xliff:g>)"</string>
-    <string name="monthly_on_day_count">"Co miesiąc (co <xliff:g id="ORDINAL_NUMBER">%1$s</xliff:g> <xliff:g id="DAY_OF_WEEK">%2$s</xliff:g>)"</string>
+    <string name="monthly_on_day_count">"Co miesiąc (<xliff:g id="ORDINAL_NUMBER">%1$s</xliff:g> <xliff:g id="DAY_OF_WEEK">%2$s</xliff:g>)"</string>
     <string name="monthly_on_day">"Co miesiąc (<xliff:g id="DAY_OF_MONTH">%s</xliff:g> każdego miesiąca)"</string>
     <string name="yearly">"Co rok (<xliff:g id="DATES">%s</xliff:g>)"</string>
     <string name="custom">"Niestandardowo… (nie można dostosować na telefonie)"</string>
     <string name="delete_title">"Usuń"</string>
     <string name="change_response_title">"Zmień odpowiedź"</string>
     <string name="preferences_title">"Ustawienia"</string>
-    <string name="preferences_general_title">"Widok kalendarza"</string>
+    <string name="preferences_general_title">"Ustawienie widoku kalendarza"</string>
     <string name="preferences_alerts_title">"Ustawienia przypomnień"</string>
-    <string name="preferences_hide_declined_title">"Ukryj odrzucone"</string>
-    <string name="preferences_alerts_type_title">"Alerty i powiadomienia"</string>
+    <string name="preferences_hide_declined_title">"Ukryj odrzucone wydarzenia"</string>
+    <string name="preferences_alerts_type_title">"Ustaw alerty i powiadomienia"</string>
     <string name="preferences_alerts_type_dialog">"Alerty i powiadomienia"</string>
     <string name="preferences_alerts_vibrate_title">"Wibracje"</string>
     <string name="preferences_alerts_ringtone_title">"Wybierz dzwonek"</string>
-    <string name="preferences_default_reminder_title">"Domyślne przypomnienie"</string>
-    <string name="preferences_default_reminder_dialog">"Domyślne przypomnienie"</string>
+    <string name="preferences_default_reminder_title">"Ustaw domyślne przypomnienie"</string>
+    <string name="preferences_default_reminder_dialog">"Domyślna godzina przypomnienia"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"Kalendarz:"</string>
+    <string name="gadget_now_event">"Teraz: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"Następne: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"Później: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"Więcej wydarzeń: 1"</item>
+    <item quantity="other">"Więcej wydarzeń: <xliff:g id="NUMBER">%d</xliff:g>"</item>
+  </plurals>
+    <string name="gadget_no_events">"Brak zbliżających się wydarzeń w kalendarzu"</string>
 </resources>
index 6eba53a..932ab19 100644 (file)
     <string name="preferences_default_reminder_title">"Установить напоминание по умолчанию"</string>
     <string name="preferences_default_reminder_dialog">"Время напоминания по умолчанию"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"Календарь:"</string>
+    <string name="gadget_now_event">"Сейчас: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"Далее: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"Позже: <xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"Еще одно событие"</item>
+    <item quantity="other">"Еще событий: <xliff:g id="NUMBER">%d</xliff:g>"</item>
+  </plurals>
+    <string name="gadget_no_events">"Нет предстоящих событий календаря"</string>
 </resources>
index 9645f48..710810f 100644 (file)
     <string name="preferences_default_reminder_title">"设置默认提醒"</string>
     <string name="preferences_default_reminder_dialog">"默认提醒时间"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"日历:"</string>
+    <string name="gadget_now_event">"当前活动:<xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"下一个活动:<xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"稍后的活动:<xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"另外 1 个活动"</item>
+    <item quantity="other">"另外 <xliff:g id="NUMBER">%d</xliff:g> 个活动"</item>
+  </plurals>
+    <string name="gadget_no_events">"近期没有日历活动"</string>
 </resources>
index e7ce72f..99d2045 100644 (file)
     <string name="preferences_default_reminder_title">"設定預設提醒"</string>
     <string name="preferences_default_reminder_dialog">"預設提醒時間"</string>
     <string name="preferences_default_reminder_default">"10"</string>
+    <string name="gadget_calendar">"日曆:"</string>
+    <string name="gadget_now_event">"目前活動:<xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_next_event">"下個活動:<xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+    <string name="gadget_later_event">"稍後活動:<xliff:g id="TIME_DATE">%s</xliff:g>"</string>
+  <plurals name="gadget_more_events">
+    <item quantity="one">"還有 1 個活動"</item>
+    <item quantity="other">"還有 <xliff:g id="NUMBER">%d</xliff:g> 個活動"</item>
+  </plurals>
+    <string name="gadget_no_events">"沒有即將開始的日曆活動"</string>
 </resources>
index 32cfc28..b72c07f 100644 (file)
     <color name="month_week_banner">#20595959</color>
 
     <color name="event_center">#ff6bd697</color>
+
+    <color name="gadget_when">#ffffffff</color>
+    <color name="gadget_reminder">#ffffffff</color>
+    <color name="gadget_title">#ff000000</color>
+    <color name="gadget_where">#ff000000</color>
+    <color name="gadget_calendar">#ff000000</color>
+
+    <color name="gadget_no_events">#bb000000</color>
     
     <drawable name="agenda_item_declined">#88ffffff</drawable>
 </resources>
index 8ee9a03..2850097 100644 (file)
     <!-- Default value for the number of reminder minutes -->
     <string name="preferences_default_reminder_default">10</string>
 
+    <!-- Bold prefix for gadget that identifies the calendar display name -->
+    <string name="gadget_calendar">Calendar:</string>
+
+    <!-- Prefix for date/time of currently happening event in gadget -->
+    <string name="gadget_now_event">Now: <xliff:g id="time_date">%s</xliff:g></string>
+    <!-- Prefix for date/time of next upcoming event in gadget -->
+    <string name="gadget_next_event">Next: <xliff:g id="time_date">%s</xliff:g></string>
+    <!-- Prefix for date/time of later upcoming event in gadget -->
+    <string name="gadget_later_event">Later: <xliff:g id="time_date">%s</xliff:g></string>
+
+    <!-- Shown in gadget when additional events are available for display, but no room remaining -->
+    <plurals name="gadget_more_events">
+        <!-- additional events message for 1 event -->
+        <item quantity="one">1 more event</item>
+        <!-- additional events message for multiple events -->
+        <item quantity="other"><xliff:g id="number">%d</xliff:g> more events</item>
+    </plurals>
+
+    <!-- Caption to show on gadget when there are no upcoming calendar events -->
+    <string name="gadget_no_events">No upcoming calendar events</string>
+
 </resources>
diff --git a/res/xml/gadget_info.xml b/res/xml/gadget_info.xml
new file mode 100644 (file)
index 0000000..317384a
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<gadget-provider xmlns:android="http://schemas.android.com/apk/res/android"
+    android:minWidth="294dip"
+    android:minHeight="72dip"
+    android:updatePeriodMillis="0"
+    android:initialLayout="@layout/gadget_item"
+    >
+</gadget-provider>
diff --git a/src/com/android/calendar/CalendarGadgetProvider.java b/src/com/android/calendar/CalendarGadgetProvider.java
new file mode 100644 (file)
index 0000000..971b268
--- /dev/null
@@ -0,0 +1,563 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.calendar;
+
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.database.Cursor;
+import android.gadget.GadgetManager;
+import android.gadget.GadgetProvider;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.net.Uri;
+import android.provider.Calendar;
+import android.provider.Calendar.Attendees;
+import android.provider.Calendar.Calendars;
+import android.provider.Calendar.EventsColumns;
+import android.provider.Calendar.Instances;
+import android.provider.Calendar.Reminders;
+import android.text.format.DateFormat;
+import android.text.format.DateUtils;
+import android.text.format.Time;
+import android.util.Config;
+import android.util.Log;
+import android.view.View;
+import android.widget.RemoteViews;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+/**
+ * Simple gadget to show next upcoming calendar event.
+ */
+public class CalendarGadgetProvider extends GadgetProvider {
+    static final String TAG = "CalendarGadgetProvider";
+    static final boolean LOGD = false;
+    
+    // TODO: listen for timezone and system time changes to update date icon
+
+    static final String EVENT_SORT_ORDER = "startDay ASC, allDay ASC, begin ASC";
+
+    static final String[] EVENT_PROJECTION = new String[] {
+        Instances.ALL_DAY,
+        Instances.BEGIN,
+        Instances.END,
+        Instances.COLOR,
+        Instances.TITLE,
+        Instances.RRULE,
+        Instances.HAS_ALARM,
+        Instances.EVENT_LOCATION,
+        Instances.CALENDAR_ID,
+        Instances.EVENT_ID,
+    };
+
+    static final int INDEX_ALL_DAY = 0;
+    static final int INDEX_BEGIN = 1;
+    static final int INDEX_END = 2;
+    static final int INDEX_COLOR = 3;
+    static final int INDEX_TITLE = 4;
+    static final int INDEX_RRULE = 5;
+    static final int INDEX_HAS_ALARM = 6;
+    static final int INDEX_EVENT_LOCATION = 7;
+    static final int INDEX_CALENDAR_ID = 8;
+    static final int INDEX_EVENT_ID = 9;
+    
+    static final long SEARCH_DURATION = DateUtils.WEEK_IN_MILLIS;
+    
+    static final long UPDATE_DELAY_TRIGGER_DURATION = DateUtils.MINUTE_IN_MILLIS * 30;
+    static final long UPDATE_DELAY_DURATION = DateUtils.MINUTE_IN_MILLIS * 5;
+    
+    static final long UPDATE_NO_EVENTS = DateUtils.DAY_IN_MILLIS;
+
+    private static final int[] DATE_ICONS = new int[] {
+        R.drawable.ic_date_01, R.drawable.ic_date_02, R.drawable.ic_date_03,
+        R.drawable.ic_date_04, R.drawable.ic_date_05, R.drawable.ic_date_06,
+        R.drawable.ic_date_07, R.drawable.ic_date_08, R.drawable.ic_date_09,
+        R.drawable.ic_date_10, R.drawable.ic_date_11, R.drawable.ic_date_12,
+        R.drawable.ic_date_13, R.drawable.ic_date_14, R.drawable.ic_date_15,
+        R.drawable.ic_date_16, R.drawable.ic_date_17, R.drawable.ic_date_18,
+        R.drawable.ic_date_19, R.drawable.ic_date_20, R.drawable.ic_date_21,
+        R.drawable.ic_date_22, R.drawable.ic_date_23, R.drawable.ic_date_24,
+        R.drawable.ic_date_25, R.drawable.ic_date_26, R.drawable.ic_date_27,
+        R.drawable.ic_date_28, R.drawable.ic_date_29, R.drawable.ic_date_30,
+        R.drawable.ic_date_31,
+    };
+    
+    @Override
+    public void onDisabled(Context context) {
+        // Unsubscribe from all AlarmManager updates
+        AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+        PendingIntent pendingUpdate = getUpdateIntent(context);
+        am.cancel(pendingUpdate);
+    }
+
+    @Override
+    public void onUpdate(Context context, GadgetManager gadgetManager, int[] gadgetIds) {
+        performUpdate(context, gadgetIds);
+    }
+    
+    static void performUpdate(Context context, int[] gadgetIds) {
+        performUpdate(context, gadgetIds, Long.MIN_VALUE, Long.MAX_VALUE);
+    }
+    
+    /**
+     * Process and push out an update for the given gadgetIds.
+     */
+    static void performUpdate(Context context, int[] gadgetIds,
+            long changedStart, long changedEnd) {
+        ContentResolver resolver = context.getContentResolver();
+        
+        Cursor cursor = null;
+        RemoteViews views = null;
+        long triggerTime = -1;
+
+        try {
+            cursor = getUpcomingInstancesCursor(resolver, SEARCH_DURATION);
+            if (cursor != null) {
+                MarkedEvents events = buildMarkedEvents(cursor);
+                if (events.primaryCount == 0) {
+                    views = getGadgetNoEvents(context);
+                } else if (causesUpdate(events, changedStart, changedEnd)) {
+                    views = getGadgetUpdate(context, cursor, events);
+                    triggerTime = calculateUpdateTime(context, cursor, events);
+                }
+            } else {
+                views = getGadgetNoEvents(context);
+            }
+        } finally {
+            if (cursor != null) {
+                cursor.close();
+            }
+        }
+        
+        // Bail out early if no update built
+        if (views == null) {
+            return;
+        }
+        
+        GadgetManager gm = GadgetManager.getInstance(context);
+        if (gadgetIds != null) {
+            gm.updateGadget(gadgetIds, views);
+        } else {
+            ComponentName thisGadget = new ComponentName(context, CalendarGadgetProvider.class);
+            gm.updateGadget(thisGadget, views);
+        }
+
+        // Schedule an alarm to wake ourselves up for the next update.  We also cancel
+        // all existing wake-ups because PendingIntents don't match against extras.
+        
+        // If no next-update calculated, schedule update about a day from now
+        long now = System.currentTimeMillis();
+        if (triggerTime == -1) {
+            triggerTime = now + UPDATE_NO_EVENTS;
+        }
+        
+        // If requested update in past then bail out. This means we lose future
+        // updates, but it's better than possibly looping to death.
+        if (triggerTime <= now) {
+            Log.w(TAG, String.format(
+                    "Encountered a bad triggerTime=%d, so bailing on future updates", triggerTime));
+        }
+        
+        // Force early update at midnight to change date, if needed
+        long nextMidnight = getNextMidnight();
+        if (triggerTime > nextMidnight) {
+            triggerTime = nextMidnight;
+        }
+        
+        AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
+        PendingIntent pendingUpdate = getUpdateIntent(context);
+        
+        am.cancel(pendingUpdate);
+        am.set(AlarmManager.RTC, triggerTime, pendingUpdate);
+
+        if (LOGD) {
+            long seconds = (triggerTime - System.currentTimeMillis()) /
+                    DateUtils.SECOND_IN_MILLIS;
+            Log.d(TAG, String.format("Scheduled next update at %d (%d seconds from now)",
+                    triggerTime, seconds));
+        }
+    }
+    
+    static PendingIntent getUpdateIntent(Context context) {
+        Intent updateIntent = new Intent(GadgetManager.ACTION_GADGET_UPDATE);
+        return PendingIntent.getBroadcast(context, 0 /* no requestCode */,
+                updateIntent, 0 /* no flags */);
+    }
+    
+    /**
+     * Figure out the best time to push gadget updates. If the event is longer
+     * than 30 minutes, we should wait until 5 minutes after it starts to
+     * replace it with next event. Otherwise we replace at start time.
+     * <p>
+     * Absolute worst case is that we don't have an upcoming event in the next
+     * week, so we should wait an entire day before the next push.
+     */
+    static long calculateUpdateTime(Context context, Cursor cursor, MarkedEvents events) {
+        ContentResolver resolver = context.getContentResolver();
+        long result = System.currentTimeMillis() + DateUtils.DAY_IN_MILLIS;
+        
+        if (events.primaryRow != -1) {
+            cursor.moveToPosition(events.primaryRow);
+            long start = cursor.getLong(INDEX_BEGIN);
+            long end = cursor.getLong(INDEX_END);
+            
+            // If event is longer than our trigger, avoid pushing an update
+            // for next event until a few minutes after it starts.  (Otherwise
+            // just push the update right as the event starts.)
+            long length = end - start;
+            if (length >= UPDATE_DELAY_TRIGGER_DURATION) {
+                result = start + UPDATE_DELAY_DURATION;
+            } else {
+                result = start;
+            }
+        }
+        return result;
+    }
+    
+    /**
+     * Return next midnight in current timezone.
+     */
+    static long getNextMidnight() {
+        Time time = new Time();
+        time.set(System.currentTimeMillis() + DateUtils.DAY_IN_MILLIS);
+        time.hour = 0;
+        time.minute = 0;
+        time.second = 0;
+        return time.toMillis(true /* ignore DST */);
+    }
+    
+    /**
+     * Build a set of {@link RemoteViews} that describes how to update any
+     * gadget for a specific event instance.
+     * 
+     * @param cursor Valid cursor on {@link Instances#CONTENT_URI}
+     * @param events {@link MarkedEvents} parsed from the cursor
+     */
+    static RemoteViews getGadgetUpdate(Context context, Cursor cursor, MarkedEvents events) {
+        Resources res = context.getResources();
+        ContentResolver resolver = context.getContentResolver();
+        
+        RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.gadget_item);
+        
+        // Clicking on gadget launches the agenda view in Calendar
+        // TODO: launch to specific primaryEventTime (bug 1648608)
+        Intent agendaIntent = new Intent(context, AgendaActivity.class);
+        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0 /* no requestCode */,
+                agendaIntent, 0 /* no flags */);
+        
+        views.setOnClickPendingIntent(R.id.gadget, pendingIntent);
+        
+        // Build calendar icon with actual date
+        Bitmap dateIcon = buildDateIcon(context);
+        views.setImageViewBitmap(R.id.icon, dateIcon);
+        views.setViewVisibility(R.id.icon, View.VISIBLE);
+        views.setViewVisibility(R.id.no_events, View.GONE);
+        
+        long nextMidnight = getNextMidnight();
+
+        // Fill primary event details
+        if (events.primaryRow != -1) {
+            views.setViewVisibility(R.id.primary_card, View.VISIBLE);
+            cursor.moveToPosition(events.primaryRow);
+            
+            // Color stripe
+            int colorFilter = cursor.getInt(INDEX_COLOR);
+            views.setDrawableParameters(R.id.when, true, -1, colorFilter,
+                    PorterDuff.Mode.SRC_IN, -1);
+            views.setTextColor(R.id.title, colorFilter);
+            views.setTextColor(R.id.where, colorFilter);
+            views.setDrawableParameters(R.id.divider, true, -1, colorFilter,
+                    PorterDuff.Mode.SRC_IN, -1);
+            views.setTextColor(R.id.title2, colorFilter);
+
+            // When
+            long start = cursor.getLong(INDEX_BEGIN);
+            boolean allDay = cursor.getInt(INDEX_ALL_DAY) != 0;
+            
+            int flags;
+            String whenString;
+            if (allDay) {
+                flags = DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_UTC
+                        | DateUtils.FORMAT_SHOW_DATE;
+            } else {
+                flags = DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_TIME;
+                // Show date if starts beyond next midnight
+                if (start > nextMidnight) {
+                    flags = flags | DateUtils.FORMAT_SHOW_DATE;
+                }
+            }
+            if (DateFormat.is24HourFormat(context)) {
+                flags |= DateUtils.FORMAT_24HOUR;
+            }
+            whenString = DateUtils.formatDateRange(context, start, start, flags);
+            views.setTextViewText(R.id.when, whenString);
+
+            // What
+            String titleString = cursor.getString(INDEX_TITLE);
+            if (titleString == null || titleString.length() == 0) {
+                titleString = context.getString(R.string.no_title_label);
+            }
+            views.setTextViewText(R.id.title, titleString);
+            
+            // Where
+            String whereString = cursor.getString(INDEX_EVENT_LOCATION);
+            if (whereString != null && whereString.length() > 0) {
+                views.setViewVisibility(R.id.where, View.VISIBLE);
+                views.setViewVisibility(R.id.stub_where, View.INVISIBLE);
+                views.setTextViewText(R.id.where, whereString);
+            } else {
+                views.setViewVisibility(R.id.where, View.GONE);
+                views.setViewVisibility(R.id.stub_where, View.GONE);
+            }
+        }
+        
+        // Fill other primary events, if present
+        if (events.primaryConflictRow != -1) {
+            views.setViewVisibility(R.id.divider, View.VISIBLE);
+            views.setViewVisibility(R.id.title2, View.VISIBLE);
+
+            if (events.primaryCount > 2) {
+                // If more than two primary conflicts, format multiple message
+                int count = events.primaryCount - 1;
+                String titleString = String.format(res.getQuantityString(
+                        R.plurals.gadget_more_events, count), count);
+                views.setTextViewText(R.id.title2, titleString);
+            } else {
+                cursor.moveToPosition(events.primaryConflictRow);
+
+                // What
+                String titleString = cursor.getString(INDEX_TITLE);
+                if (titleString == null || titleString.length() == 0) {
+                    titleString = context.getString(R.string.no_title_label);
+                }
+                views.setTextViewText(R.id.title2, titleString);
+            }
+        } else {
+            views.setViewVisibility(R.id.divider, View.GONE);
+            views.setViewVisibility(R.id.title2, View.GONE);
+        }
+        
+        // Fill secondary event
+        if (events.secondaryRow != -1) {
+            views.setViewVisibility(R.id.secondary_card, View.VISIBLE);
+            views.setViewVisibility(R.id.secondary_when, View.VISIBLE);
+            views.setViewVisibility(R.id.secondary_title, View.VISIBLE);
+            
+            cursor.moveToPosition(events.secondaryRow);
+            
+            // Color stripe
+            int colorFilter = cursor.getInt(INDEX_COLOR);
+            views.setDrawableParameters(R.id.secondary_when, true, -1, colorFilter,
+                    PorterDuff.Mode.SRC_IN, -1);
+            views.setTextColor(R.id.secondary_title, colorFilter);
+            
+            // When
+            long start = cursor.getLong(INDEX_BEGIN);
+            boolean allDay = cursor.getInt(INDEX_ALL_DAY) != 0;
+            
+            int flags;
+            String whenString;
+            if (allDay) {
+                flags = DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_UTC
+                        | DateUtils.FORMAT_SHOW_DATE;
+            } else {
+                flags = DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_TIME;
+                // Show date if starts beyond next midnight
+                if (start > nextMidnight) {
+                    flags = flags | DateUtils.FORMAT_SHOW_DATE;
+                }
+            }
+            if (DateFormat.is24HourFormat(context)) {
+                flags |= DateUtils.FORMAT_24HOUR;
+            }
+            whenString = DateUtils.formatDateRange(context, start, start, flags);
+            views.setTextViewText(R.id.secondary_when, whenString);
+            
+            if (events.secondaryCount > 1) {
+                // If more than two secondary conflicts, format multiple message
+                int count = events.secondaryCount;
+                String titleString = String.format(res.getQuantityString(
+                        R.plurals.gadget_more_events, count), count);
+                views.setTextViewText(R.id.secondary_title, titleString);
+            } else {
+                // What
+                String titleString = cursor.getString(INDEX_TITLE);
+                if (titleString == null || titleString.length() == 0) {
+                    titleString = context.getString(R.string.no_title_label);
+                }
+                views.setTextViewText(R.id.secondary_title, titleString);
+            }
+        } else {
+            views.setViewVisibility(R.id.secondary_when, View.GONE);
+            views.setViewVisibility(R.id.secondary_title, View.GONE);
+        }
+        
+        return views;
+    }
+    
+    /**
+     * Build a set of {@link RemoteViews} that describes an error state.
+     */
+    static RemoteViews getGadgetNoEvents(Context context) {
+        RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.gadget_item);
+
+        views.setViewVisibility(R.id.icon, View.GONE);
+        views.setViewVisibility(R.id.no_events, View.VISIBLE);
+        
+        views.setViewVisibility(R.id.primary_card, View.GONE);
+        views.setViewVisibility(R.id.secondary_card, View.GONE);
+        
+        // Clicking on gadget launches the agenda view in Calendar
+        Intent agendaIntent = new Intent(context, AgendaActivity.class);
+        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0 /* no requestCode */,
+                agendaIntent, 0 /* no flags */);
+        
+        views.setOnClickPendingIntent(R.id.gadget, pendingIntent);
+
+        return views;
+    }
+    
+    /**
+     * Build super-awesome calendar icon with actual date overlay. Uses current
+     * system date to generate.
+     */
+    static Bitmap buildDateIcon(Context context) {
+        Time time = new Time();
+        time.setToNow();
+        int dateNumber = time.monthDay;
+        
+        Resources res = context.getResources();
+        Bitmap blankIcon = BitmapFactory.decodeResource(res, R.drawable.app_icon_blank);
+        Bitmap overlay = BitmapFactory.decodeResource(res, DATE_ICONS[dateNumber - 1]);
+        
+        Bitmap result = Bitmap.createBitmap(blankIcon.getWidth(),
+                blankIcon.getHeight(), blankIcon.getConfig());
+        
+        Canvas canvas = new Canvas(result);
+        Paint paint = new Paint();
+        
+        canvas.drawBitmap(blankIcon, 0f, 0f, paint);
+        canvas.drawBitmap(overlay, 0f, 0f, paint);
+        
+        return result;
+    }
+
+    static class MarkedEvents {
+        long primaryTime = -1;
+        int primaryRow = -1;
+        int primaryConflictRow = -1;
+        int primaryCount = 0;
+        long secondaryTime = -1;
+        int secondaryRow = -1;
+        int secondaryCount = 0;
+    }
+    
+    /**
+     * Check if the given {@link MarkedEvents} should cause an update based on a
+     * time span, usually coming from a calendar changed event.
+     */
+    static boolean causesUpdate(MarkedEvents events, long changedStart, long changedEnd) {
+        boolean primaryTouched =
+            (events.primaryTime >= changedStart && events.primaryTime <= changedEnd);
+        boolean secondaryTouched =
+            (events.secondaryTime >= changedStart && events.secondaryTime <= changedEnd);
+        return (primaryTouched || secondaryTouched);
+    }
+    
+    /**
+     * Walk the given instances cursor and build a list of marked events to be
+     * used when updating the gadget. This structure is also used to check if
+     * updates are needed.  Assumes the incoming cursor is valid.
+     */
+    static MarkedEvents buildMarkedEvents(Cursor cursor) {
+        MarkedEvents events = new MarkedEvents();
+        long now = System.currentTimeMillis();
+        
+        cursor.moveToPosition(-1);
+        while (cursor.moveToNext()) {
+            int row = cursor.getPosition();
+            long begin = cursor.getLong(INDEX_BEGIN);
+            boolean allDay = cursor.getInt(INDEX_ALL_DAY) != 0;
+            
+            // Skip all-day events that have already started
+            if (allDay && begin < now) {
+                continue;
+            }
+            
+            if (events.primaryRow == -1) {
+                // Found first event
+                events.primaryRow = row;
+                events.primaryTime = begin;
+                events.primaryCount = 1;
+            } else if (events.primaryTime == begin) {
+                // Found conflicting primary event
+                if (events.primaryConflictRow == -1) {
+                    events.primaryConflictRow = row;
+                }
+                events.primaryCount += 1;
+            } else if (events.secondaryRow == -1) {
+                // Found second event
+                events.secondaryRow = row;
+                events.secondaryTime = begin;
+                events.secondaryCount = 1;
+            } else if (events.secondaryTime == begin) {
+                // Found conflicting secondary event
+                events.secondaryCount += 1;
+            } else {
+                // Nothing interesting about this event, so bail out
+            }
+        }
+        return events;
+    }
+    
+    /**
+     * Query across all calendars for upcoming event instances from now until
+     * some time in the future.
+     * 
+     * @param searchDuration Distance into the future to look for event
+     *            instances, in milliseconds.
+     */
+    static Cursor getUpcomingInstancesCursor(ContentResolver resolver, long searchDuration) {
+        // Search for events from now until some time in the future
+        long start = System.currentTimeMillis();
+        long end = start + searchDuration;
+        
+        Uri uri = Uri.withAppendedPath(Instances.CONTENT_URI,
+                String.format("%d/%d", start, end));
+
+        // Make sure we only look at events *starting* after now
+        String selection = String.format("%s=1 AND %s!=%d AND %s>=%d",
+                Calendars.SELECTED, Instances.SELF_ATTENDEE_STATUS,
+                Attendees.ATTENDEE_STATUS_DECLINED, Instances.BEGIN, start);
+        
+        return resolver.query(uri, EVENT_PROJECTION, selection, null,
+                EVENT_SORT_ORDER);
+    }
+    
+}
index a50c44b..e664ae6 100644 (file)
@@ -36,6 +36,7 @@ import android.graphics.RectF;
 import android.graphics.Typeface;
 import android.graphics.Paint.Style;
 import android.graphics.Path.Direction;
+import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Handler;
 import android.provider.Calendar.Attendees;
@@ -44,7 +45,6 @@ import android.provider.Calendar.Events;
 import android.text.format.DateFormat;
 import android.text.format.DateUtils;
 import android.text.format.Time;
-import android.text.TextUtils;
 import android.util.Log;
 import android.view.ContextMenu;
 import android.view.Gravity;
@@ -54,8 +54,6 @@ import android.view.MenuItem;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewConfiguration;
-import android.view.ViewGroup;
-import android.view.WindowManager;
 import android.view.ContextMenu.ContextMenuInfo;
 import android.widget.ImageView;
 import android.widget.PopupWindow;
@@ -126,6 +124,10 @@ public class CalendarView extends View
     private long mLastReloadMillis;
 
     private ArrayList<Event> mEvents = new ArrayList<Event>();
+    private Drawable mBoxNormal;
+    private Drawable mBoxSelected;
+    private Drawable mBoxPressed;
+    private Drawable mBoxLongPressed;
     private int mSelectionDay;        // Julian day
     private int mSelectionHour;
 
@@ -152,6 +154,7 @@ public class CalendarView extends View
 
     private PopupWindow mPopup;
     private View mPopupView;
+    private static final int POPUP_HEIGHT = 67;
 
     // The number of milliseconds to show the popup window
     private static final int POPUP_DISMISS_DELAY = 3000;
@@ -209,6 +212,7 @@ public class CalendarView extends View
     private int mViewHeight;
     private int mViewWidth;
     private int mGridAreaHeight;
+    private int mGridAreaWidth;
     private int mCellHeight;
     private int mScrollStartY;
     private int mPreviousDirection;
@@ -372,13 +376,14 @@ public class CalendarView extends View
         p.setTextSize(AMPM_FONT_SIZE);
         mHoursWidth = computeMaxStringWidth(mHoursWidth, ampm, p);
         mHoursWidth += HOURS_MARGIN;
+        mBoxNormal = mResources.getDrawable(R.drawable.box_appointment_normal);
+        mBoxSelected = mResources.getDrawable(R.drawable.box_appointment_selected);
+        mBoxPressed = mResources.getDrawable(R.drawable.box_appointment_pressed);
+        mBoxLongPressed = mResources.getDrawable(R.drawable.box_appointment_longpress);
 
         LayoutInflater inflater;
         inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         mPopupView = inflater.inflate(R.layout.bubble_event, null);
-        mPopupView.setLayoutParams(new ViewGroup.LayoutParams(
-                ViewGroup.LayoutParams.FILL_PARENT,
-                ViewGroup.LayoutParams.WRAP_CONTENT));
         mPopup = new PopupWindow(context);
         mPopup.setContentView(mPopupView);
         Resources.Theme dialogTheme = getResources().newTheme();
@@ -537,8 +542,8 @@ public class CalendarView extends View
     protected void onSizeChanged(int width, int height, int oldw, int oldh) {
         mViewWidth = width;
         mViewHeight = height;
-        int gridAreaWidth = width - mHoursWidth;
-        mCellWidth = (gridAreaWidth - (mNumDays * DAY_GAP)) / mNumDays;
+        mGridAreaWidth = width - mHoursWidth;
+        mCellWidth = (mGridAreaWidth - (mNumDays * DAY_GAP)) / mNumDays;
 
         Paint p = new Paint();
         p.setTextSize(NORMAL_FONT_SIZE);
@@ -675,7 +680,7 @@ public class CalendarView extends View
         int eventAreaWidth = mNumDays * (mCellWidth + DAY_GAP);
         mPopup.dismiss();
         mPopup.setWidth(eventAreaWidth - 20);
-        mPopup.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
+        mPopup.setHeight(POPUP_HEIGHT);
     }
 
     /**
@@ -855,7 +860,7 @@ public class CalendarView extends View
 
         mSelectionMode = SELECTION_SELECTED;
         mScrolling = false;
-        boolean redraw;
+        boolean redraw = false;
         int selectionDay = mSelectionDay;
 
         switch (keyCode) {
@@ -1755,10 +1760,10 @@ public class CalendarView extends View
         int startEventDistance1 = 100000;  // any large number
         int startEventDistance2 = 100000;  // any large number
         int prevLocation = FROM_NONE;
-        int prevTop;
-        int prevBottom;
-        int prevLeft;
-        int prevRight;
+        int prevTop = 0;
+        int prevBottom = 0;
+        int prevLeft = 0;
+        int prevRight = 0;
         int prevCenter = 0;
         Rect box = getCurrentSelectionPosition();
         if (mPrevSelectedEvent != null) {
@@ -2045,17 +2050,17 @@ public class CalendarView extends View
                 mPrevSelectedEvent = event;
                 // box = mBoxPressed;
                 p.setColor(mPressedColor); // FIXME:pressed
-                eventTextPaint.setColor(mSelectedEventTextColor);
+                eventTextPaint.setColor(this.mSelectedEventTextColor);
             } else if (mSelectionMode == SELECTION_SELECTED) {
                 // Also, remember the last selected event that we drew
                 mPrevSelectedEvent = event;
                 // box = mBoxSelected;
                 p.setColor(mSelectionColor);
-                eventTextPaint.setColor(mSelectedEventTextColor);
+                eventTextPaint.setColor(this.mSelectedEventTextColor);
             } else if (mSelectionMode == SELECTION_LONGPRESS) {
                 // box = mBoxLongPressed;
                 p.setColor(mPressedColor); // FIXME: longpressed (maybe -- this doesn't seem to work)
-                eventTextPaint.setColor(mSelectedEventTextColor);
+                eventTextPaint.setColor(this.mSelectedEventTextColor);
             } else {
                 p.setColor(color);
                 eventTextPaint.setColor(mEventTextColor);
@@ -2081,7 +2086,7 @@ public class CalendarView extends View
     }
 
     private void drawEventText(Event event, RectF rf, Canvas canvas, Paint p, int topMargin) {
-        if (!mDrawTextInEventRect) {
+        if (mDrawTextInEventRect == false) {
             return;
         }
 
@@ -2205,9 +2210,7 @@ public class CalendarView extends View
         timeView.setText(timeRange);
 
         TextView whereView = (TextView) mPopupView.findViewById(R.id.where);
-        final boolean empty = TextUtils.isEmpty(event.location);
-        whereView.setVisibility(empty ? View.GONE : View.VISIBLE);
-        if (!empty) whereView.setText(event.location);
+        whereView.setText(event.location);
 
         mPopup.showAtLocation(this, Gravity.BOTTOM | Gravity.LEFT, mHoursWidth, 5);
         postDelayed(mDismissPopup, POPUP_DISMISS_DELAY);
@@ -2382,6 +2385,7 @@ public class CalendarView extends View
         CalendarView view = mParentActivity.getNextView();
         Time date = view.mBaseDate;
         date.set(mBaseDate);
+        int selectionDay;
         boolean switchForward;
         if (deltaX > 0) {
             date.monthDay -= mNumDays;
@@ -2675,11 +2679,15 @@ public class CalendarView extends View
             if (attendeesCursor.moveToFirst()) {
                 relationship = attendeesCursor.getInt(ATTENDEES_INDEX_RELATIONSHIP);
             }
-            attendeesCursor.close();
         }
+        attendeesCursor.close();
 
-        return visibility >= Calendars.CONTRIBUTOR_ACCESS &&
-                relationship >= Attendees.RELATIONSHIP_ORGANIZER;
+        if (visibility >= Calendars.CONTRIBUTOR_ACCESS &&
+                relationship >= Attendees.RELATIONSHIP_ORGANIZER) {
+            return true;
+        }
+
+        return false;
     }
 
     /**
index 44943eb..0b00bbc 100644 (file)
@@ -81,6 +81,12 @@ public class SelectCalendarsActivity extends Activity implements ListView.OnItem
     @Override
     public void onPause() {
         super.onPause();
+        
+        // We might have changed selected calendars, so push gadget updates
+        
+        // TODO: remove this once we link up CalendarProvider and any gadgets to watch
+        // for updates to the Calendar table.
+        CalendarGadgetProvider.performUpdate(this, null);
     }
     
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
index 6f0d775..7b34ac4 100644 (file)
@@ -23,20 +23,19 @@ import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.util.Log;
 
-import java.util.Calendar;
 
 /**
  * Unit tests for {@link android.text.format.DateUtils#formatDateRange}.
  */
 public class FormatDateRangeTest extends AndroidTestCase {
 
-    private class DateTest {
+    private class DateRange {
         public Time date1;
         public Time date2;
         public int flags;
         public String expectedOutput;
 
-        public DateTest(int year1, int month1, int day1, int hour1, int minute1,
+        public DateRange(int year1, int month1, int day1, int hour1, int minute1,
                 int year2, int month2, int day2, int hour2, int minute2,
                 int flags, String output) {
             if ((flags & DateUtils.FORMAT_UTC) != 0) {
@@ -62,117 +61,95 @@ public class FormatDateRangeTest extends AndroidTestCase {
             this.flags = flags;
             expectedOutput = output;
         }
-
-        // Single point in time.  (not a range)
-        public DateTest(int year1, int month1, int day1, int hour1, int minute1,
-                         int flags, String output) {
-            this(year1, month1, day1, hour1, minute1,
-                 year1, month1, day1, hour1, minute1,
-                 flags, output);
-        }
     }
 
     private Resources mResources;
 
-    DateTest[] tests = {
-            new DateTest(0, 10, 9, 8, 0, 0, 10, 9, 11, 0,
+    DateRange[] tests = {
+            new DateRange(0, 10, 9, 8, 0, 0, 10, 9, 11, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL, "8am \u2013 11am"),
-            new DateTest(0, 10, 9, 8, 0, 0, 10, 9, 11, 0,
+            new DateRange(0, 10, 9, 8, 0, 0, 10, 9, 11, 0,
                     DateUtils.FORMAT_SHOW_TIME, "8:00am \u2013 11:00am"),
-            new DateTest(0, 10, 9, 8, 0, 0, 10, 9, 17, 0,
+            new DateRange(0, 10, 9, 8, 0, 0, 10, 9, 17, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_24HOUR, "08:00 \u2013 17:00"),
-            new DateTest(0, 10, 9, 8, 0, 0, 10, 9, 12, 0,
+            new DateRange(0, 10, 9, 8, 0, 0, 10, 9, 12, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL, "8am \u2013 noon"),
-            new DateTest(0, 10, 9, 8, 0, 0, 10, 9, 12, 0,
+            new DateRange(0, 10, 9, 8, 0, 0, 10, 9, 12, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_ABBREV_ALL,
                     "8am \u2013 12pm"),
-            new DateTest(0, 10, 9, 8, 0, 0, 10, 9, 12, 0,
+            new DateRange(0, 10, 9, 8, 0, 0, 10, 9, 12, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_CAP_NOON | DateUtils.FORMAT_ABBREV_ALL,
                     "8am \u2013 Noon"),
-            new DateTest(0, 10, 9, 10, 30, 0, 10, 9, 13, 0,
+            new DateRange(0, 10, 9, 10, 30, 0, 10, 9, 13, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL, "10:30am \u2013 1pm"),
-            new DateTest(0, 10, 9, 13, 0, 0, 10, 9, 14, 0,
+            new DateRange(0, 10, 9, 13, 0, 0, 10, 9, 14, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL, "1pm \u2013 2pm"),
-            new DateTest(0, 10, 9, 0, 0, 0, 10, 9, 14, 0,
+            new DateRange(0, 10, 9, 0, 0, 0, 10, 9, 14, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL, "12am \u2013 2pm"),
-            new DateTest(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL, "8pm \u2013 midnight"),
-            new DateTest(0, 10, 10, 0, 0,
+            new DateRange(0, 10, 10, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL, "12am"),
-            new DateTest(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_24HOUR | DateUtils.FORMAT_ABBREV_ALL,
                     "20:00 \u2013 00:00"),
-            new DateTest(0, 10, 10, 0, 0,
+            new DateRange(0, 10, 10, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_24HOUR | DateUtils.FORMAT_ABBREV_ALL,
                     "00:00"),
-            new DateTest(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL, "Nov 9"),
-            new DateTest(0, 10, 10, 0, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 10, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL, "Nov 10"),
-            new DateTest(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_24HOUR | DateUtils.FORMAT_ABBREV_ALL,
                     "Nov 9"),
-            new DateTest(0, 10, 10, 0, 0,
+            new DateRange(0, 10, 10, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_24HOUR | DateUtils.FORMAT_ABBREV_ALL,
                     "Nov 10"),
-            new DateTest(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_MIDNIGHT | DateUtils.FORMAT_ABBREV_ALL,
                     "8pm \u2013 12am"),
-            new DateTest(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 20, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_CAP_MIDNIGHT | DateUtils.FORMAT_ABBREV_ALL,
                     "8pm \u2013 Midnight"),
-            new DateTest(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL, "12am \u2013 midnight"),
-            new DateTest(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_24HOUR | DateUtils.FORMAT_ABBREV_ALL,
                     "00:00 \u2013 00:00"),
-            new DateTest(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_UTC | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL, "Nov 9"),
-            new DateTest(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_UTC | DateUtils.FORMAT_ABBREV_ALL, "Nov 9"),
-            new DateTest(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 9, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_UTC, "November 9"),
-            new DateTest(0, 10, 8, 0, 0, 0, 10, 10, 0, 0,
+            new DateRange(0, 10, 8, 0, 0, 0, 10, 10, 0, 0,
                     DateUtils.FORMAT_UTC | DateUtils.FORMAT_ABBREV_ALL, "Nov 8 \u2013 9"),
-            new DateTest(0, 10, 9, 0, 0, 0, 10, 11, 0, 0,
+            new DateRange(0, 10, 9, 0, 0, 0, 10, 11, 0, 0,
                     DateUtils.FORMAT_UTC | DateUtils.FORMAT_ABBREV_ALL, "Nov 9 \u2013 10"),
-            new DateTest(0, 10, 9, 8, 0, 0, 10, 11, 17, 0,
+            new DateRange(0, 10, 9, 8, 0, 0, 10, 11, 17, 0,
                     DateUtils.FORMAT_UTC | DateUtils.FORMAT_ABBREV_ALL, "Nov 9 \u2013 11"),
-            new DateTest(0, 9, 29, 8, 0, 0, 10, 3, 17, 0,
+            new DateRange(0, 9, 29, 8, 0, 0, 10, 3, 17, 0,
                     DateUtils.FORMAT_UTC | DateUtils.FORMAT_ABBREV_ALL, "Oct 29 \u2013 Nov 3"),
-            new DateTest(2007, 11, 29, 8, 0, 2008, 0, 2, 17, 0,
+            new DateRange(2007, 11, 29, 8, 0, 2008, 0, 2, 17, 0,
                     DateUtils.FORMAT_UTC | DateUtils.FORMAT_ABBREV_ALL, "Dec 29, 2007 \u2013 Jan 2, 2008"),
-            new DateTest(2007, 11, 29, 0, 0, 2008, 0, 2, 0, 0,
+            new DateRange(2007, 11, 29, 0, 0, 2008, 0, 2, 0, 0,
                     DateUtils.FORMAT_UTC | DateUtils.FORMAT_ABBREV_ALL, "Dec 29, 2007 \u2013 Jan 1, 2008"),
-            new DateTest(2007, 11, 29, 8, 0, 2008, 0, 2, 17, 0,
+            new DateRange(2007, 11, 29, 8, 0, 2008, 0, 2, 17, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL,
                     "Dec 29, 2007, 8am \u2013 Jan 2, 2008, 5pm"),
-            new DateTest(0, 10, 9, 8, 0, 0, 10, 11, 17, 0,
+            new DateRange(0, 10, 9, 8, 0, 0, 10, 11, 17, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_ALL,
                     "Nov 9, 8am \u2013 Nov 11, 5pm"),
-            new DateTest(2007, 10, 9, 8, 0, 2007, 10, 11, 17, 0,
+            new DateRange(2007, 10, 9, 8, 0, 2007, 10, 11, 17, 0,
                     DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_ABBREV_ALL,
                     "Fri, Nov 9, 2007 \u2013 Sun, Nov 11, 2007"),
-            new DateTest(2007, 10, 9, 8, 0, 2007, 10, 11, 17, 0,
+            new DateRange(2007, 10, 9, 8, 0, 2007, 10, 11, 17, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_ABBREV_ALL,
                     "Fri, Nov 9, 2007, 8am \u2013 Sun, Nov 11, 2007, 5pm"),
-            new DateTest(2007, 11, 3, 13, 0, 2007, 11, 3, 14, 0,
+            new DateRange(2007, 11, 3, 13, 0, 2007, 11, 3, 14, 0,
                     DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR,
                     "1:00pm \u2013 2:00pm, December 3, 2007"),
-            // Tests that FORMAT_SHOW_YEAR takes precedence over FORMAT_NO_YEAR:
-            new DateTest(2007, 11, 3, 13, 0, 2007, 11, 3, 13, 0,
-                    DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_NO_YEAR,
-                    "December 3, 2007"),
-            // Tests that year isn't shown by default with no year flags when time is the current year:
-            new DateTest(
-                    Calendar.getInstance().get(Calendar.YEAR), 0, 3, 13, 0,
-                    DateUtils.FORMAT_SHOW_DATE,
-                    "January 3"),
-            // Tests that the year is shown by default with no year flags when time isn't the current year:
-            new DateTest(
-                    Calendar.getInstance().get(Calendar.YEAR) - 1, 0, 3, 13, 0,
-                    DateUtils.FORMAT_SHOW_DATE,
-                    "January 3, 2008"),
     };
 
     @Override
@@ -186,17 +163,17 @@ public class FormatDateRangeTest extends AndroidTestCase {
     public void testAll() throws Exception {
         int len = tests.length;
         for (int index = 0; index < len; index++) {
-            DateTest dateTest = tests[index];
-            long startMillis = dateTest.date1.toMillis(false /* use isDst */);
-            long endMillis = dateTest.date2.toMillis(false /* use isDst */);
-            int flags = dateTest.flags;
+            DateRange dateRange = tests[index];
+            long startMillis = dateRange.date1.toMillis(false /* use isDst */);
+            long endMillis = dateRange.date2.toMillis(false /* use isDst */);
+            int flags = dateRange.flags;
             String output = DateUtils.formatDateRange(mContext, startMillis, endMillis, flags);
-            if (!dateTest.expectedOutput.equals(output)) {
+            if (!dateRange.expectedOutput.equals(output)) {
                 Log.i("FormatDateRangeTest", "index " + index
-                        + " expected: " + dateTest.expectedOutput
+                        + " expected: " + dateRange.expectedOutput
                         + " actual: " + output);
             }
-            assertEquals(dateTest.expectedOutput, output);
+            assertEquals(dateRange.expectedOutput, output);
         }
     }
 }