diff options
author | James Lemieux <jplemieux@google.com> | 2016-04-05 18:40:40 -0700 |
---|---|---|
committer | James Lemieux <jplemieux@google.com> | 2016-04-06 14:05:28 -0700 |
commit | 592c66b3eb497d24d1528fb2597059c6e4ec6620 (patch) | |
tree | f14553bd763f81892b049f9f4fe76b84bb66a011 /res | |
parent | a5c107781dc8f8239bc980d19e1e31ed262e8829 (diff) | |
download | android_packages_apps_DeskClock-592c66b3eb497d24d1528fb2597059c6e4ec6620.tar.gz android_packages_apps_DeskClock-592c66b3eb497d24d1528fb2597059c6e4ec6620.tar.bz2 android_packages_apps_DeskClock-592c66b3eb497d24d1528fb2597059c6e4ec6620.zip |
Introduce world city widget
Bug: 27282291
Bug: 27693716
Bug: 24126517
This CL includes:
- full implementation of city widget
- event logging for creation/deletion of widgets
- tapping all widgets now opens the app in the prior state
(not the clock tab)
Change-Id: Ia43ec0ebf2f02aba6b7e277e5feca3e8afa91e64
Diffstat (limited to 'res')
-rw-r--r-- | res/drawable-nodpi/appwidget_city_clock_preview.png | bin | 0 -> 11487 bytes | |||
-rw-r--r-- | res/drawable-nodpi/appwidget_digital_clock_preview.png | bin | 11323 -> 15661 bytes | |||
-rw-r--r-- | res/layout/city_widget.xml | 65 | ||||
-rw-r--r-- | res/layout/widget_city_list_item.xml | 52 | ||||
-rw-r--r-- | res/values-sw600dp/dimens.xml | 3 | ||||
-rw-r--r-- | res/values-v23/styles.xml | 1 | ||||
-rw-r--r-- | res/values/dimens.xml | 5 | ||||
-rw-r--r-- | res/values/donottranslate.xml | 2 | ||||
-rw-r--r-- | res/values/donottranslate_events.xml | 3 | ||||
-rw-r--r-- | res/values/strings.xml | 11 | ||||
-rw-r--r-- | res/xml/city_appwidget.xml | 28 |
11 files changed, 166 insertions, 4 deletions
diff --git a/res/drawable-nodpi/appwidget_city_clock_preview.png b/res/drawable-nodpi/appwidget_city_clock_preview.png Binary files differnew file mode 100644 index 000000000..176b547f3 --- /dev/null +++ b/res/drawable-nodpi/appwidget_city_clock_preview.png diff --git a/res/drawable-nodpi/appwidget_digital_clock_preview.png b/res/drawable-nodpi/appwidget_digital_clock_preview.png Binary files differindex 88c84a3c1..e0922a14a 100644 --- a/res/drawable-nodpi/appwidget_digital_clock_preview.png +++ b/res/drawable-nodpi/appwidget_digital_clock_preview.png diff --git a/res/layout/city_widget.xml b/res/layout/city_widget.xml new file mode 100644 index 000000000..40592b91f --- /dev/null +++ b/res/layout/city_widget.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/city_widget" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center" + android:orientation="vertical"> + + <TextClock + android:id="@+id/clock" + style="@style/widget_big_thin" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal|top" + android:ellipsize="none" + android:includeFontPadding="false" + android:singleLine="true" + android:textColor="@color/clock_white" /> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal|top"> + + <TextView + android:id="@+id/city_name" + style="@style/widget_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="end" + android:includeFontPadding="false" + android:singleLine="true" + android:textAllCaps="true" + android:textColor="@color/clock_white" /> + + <TextClock + android:id="@+id/city_day" + style="@style/widget_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="none" + android:includeFontPadding="false" + android:singleLine="true" + android:textAllCaps="true" + android:textColor="@color/clock_white" /> + + </LinearLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/res/layout/widget_city_list_item.xml b/res/layout/widget_city_list_item.xml new file mode 100644 index 000000000..98704821b --- /dev/null +++ b/res/layout/widget_city_list_item.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?android:attr/selectableItemBackground" + android:gravity="center_vertical" + android:minHeight="@dimen/cities_list_item_height"> + + <TextView + android:id="@+id/index" + android:layout_width="74dp" + android:layout_height="match_parent" + android:gravity="center" + android:textColor="@color/clock_white" + android:textSize="@dimen/label_text_size" + android:textStyle="bold" /> + + <TextView + android:id="@+id/city_name" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:ellipsize="end" + android:paddingEnd="10dp" + android:paddingStart="16dp" + android:singleLine="true" + android:textAppearance="@style/PrimaryLabelTextAppearance" /> + + <TextView + android:id="@+id/city_time" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:textAppearance="@style/SecondaryLabelTextAppearance" /> + +</LinearLayout>
\ No newline at end of file diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml index a1ffa8c02..b59447268 100644 --- a/res/values-sw600dp/dimens.xml +++ b/res/values-sw600dp/dimens.xml @@ -90,5 +90,8 @@ <dimen name="min_digital_widget_width">300dp</dimen> <dimen name="min_digital_widget_height">170dp</dimen> + <!-- The fixed size of the font for the city name / day of week in the city widget. --> + <dimen name="city_widget_name_font_size">20dp</dimen> + <dimen name="footer_button_size">80dip</dimen> </resources> diff --git a/res/values-v23/styles.xml b/res/values-v23/styles.xml index 68e892d50..f55c40e46 100644 --- a/res/values-v23/styles.xml +++ b/res/values-v23/styles.xml @@ -9,6 +9,7 @@ </style> <style name="widget_label" parent="label"> + <item name="android:fontFamily">sans-serif-light</item> <item name="android:textAllCaps">true</item> <item name="android:letterSpacing">0.15</item> <item name="android:shadowRadius">@dimen/digital_widget_shadow_radius</item> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index d97da2aed..a77b77bb7 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -131,6 +131,11 @@ <dimen name="min_digital_widget_width">206dp</dimen> <dimen name="min_digital_widget_height">129dp</dimen> + <!-- The fixed size of the font for the city name / day of week in the city widget. --> + <dimen name="city_widget_name_font_size">12dp</dimen> + <!-- The maximum size of the font for the time in the city widget. --> + <dimen name="city_widget_max_clock_font_size">104dp</dimen> + <!-- shadow styles for digital widget text --> <item name="digital_widget_shadow_radius" format="float" type="dimen">2.75</item> <item name="digital_widget_shadow_dy" format="float" type="dimen">2.0</item> diff --git a/res/values/donottranslate.xml b/res/values/donottranslate.xml index 29c61e44c..4fb3d0685 100644 --- a/res/values/donottranslate.xml +++ b/res/values/donottranslate.xml @@ -15,6 +15,8 @@ --> <resources> + <!-- Format for displaying the day of week with a preceding slash divider. --> + <string name="abbrev_wday"> / EEE</string> <!-- String matching the lock screen format for displaying the date. --> <string name="abbrev_wday_month_day_no_year">EEEMMMd</string> <!-- Format for describing the date, for accessibility. --> diff --git a/res/values/donottranslate_events.xml b/res/values/donottranslate_events.xml index 5e641622b..d7f203965 100644 --- a/res/values/donottranslate_events.xml +++ b/res/values/donottranslate_events.xml @@ -19,6 +19,9 @@ <string name="category_clock">Clock</string> <string name="category_timer">Timer</string> <string name="category_stopwatch">Stopwatch</string> + <string name="category_city_widget">City Widget</string> + <string name="category_analog_widget">Analog Widget</string> + <string name="category_digital_widget">Digital Widget</string> <!-- Action names for events describe what type of manipulation was performed. --> <string name="action_dismiss">Dismiss</string> diff --git a/res/values/strings.xml b/res/values/strings.xml index 10716ed4e..a5189f22d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -184,9 +184,15 @@ this character, i.e. "Mon, Tue, Wed" --> <string name="day_concat">", "</string> - <!-- Label for analog clock gadget displayed on-screen when that gadget is represented to the user. --> + <!-- Label for analog clock gadget displayed in the widget picker. [CHAR LIMIT=18] --> <string name="analog_gadget">Analog clock</string> + <!-- Label for digital clock gadget displayed in the widget picker. [CHAR LIMIT=18] --> + <string name="digital_gadget">Digital clock</string> + + <!-- Label for city clock gadget displayed in the widget picker. [CHAR LIMIT=18] --> + <string name="city_gadget">World clock</string> + <!-- Settings activity name --> <!-- Label for the Settings activity displayed on-screen when that activity must be represented to the user. --> <string name="settings">Settings</string> @@ -748,9 +754,6 @@ <!-- Description of field showing the next alarm time in the clock page, for accessibility. --> <string name="next_alarm_description">Next alarm: <xliff:g id="alarm_time" example="Wed 8:00am">%s</xliff:g></string> - <!-- Label for digital clock gadget displayed on-screen when that gadget is represented to the user. --> - <string name="digital_gadget">Digital clock</string> - <!-- String for no alarms --> <string name="no_alarms">No Alarms</string> diff --git a/res/xml/city_appwidget.xml b/res/xml/city_appwidget.xml new file mode 100644 index 000000000..3dbbc88fe --- /dev/null +++ b/res/xml/city_appwidget.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2016 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. +--> + +<appwidget-provider + xmlns:android="http://schemas.android.com/apk/res/android" + android:configure="com.android.deskclock.worldclock.WidgetCitySelectionActivity" + android:initialLayout="@layout/city_widget" + android:minHeight="59dp" + android:minWidth="136dp" + android:minResizeHeight="59dp" + android:minResizeWidth="136dp" + android:previewImage="@drawable/appwidget_city_clock_preview" + android:resizeMode="horizontal|vertical" + android:updatePeriodMillis="0" + android:widgetCategory="keyguard|home_screen" />
\ No newline at end of file |