am 44c4dd93: am 8990e28b: Merge "Update default keyguard clock to new UX specification" into klp-dev
* commit '44c4dd9316f00f22c68707bcf4dbf2326649628c': Update default keyguard clock to new UX specification
BIN
packages/Keyguard/res/drawable-hdpi/ic_alarm_small.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
packages/Keyguard/res/drawable-mdpi/ic_alarm_small.png
Normal file
|
After Width: | Height: | Size: 758 B |
|
Before Width: | Height: | Size: 839 B |
BIN
packages/Keyguard/res/drawable-sw600dp-hdpi/ic_alarm_small.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
packages/Keyguard/res/drawable-sw600dp-mdpi/ic_alarm_small.png
Normal file
|
After Width: | Height: | Size: 847 B |
BIN
packages/Keyguard/res/drawable-sw600dp-xhdpi/ic_alarm_small.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
packages/Keyguard/res/drawable-sw600dp-xxhdpi/ic_alarm_small.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
packages/Keyguard/res/drawable-xhdpi/ic_alarm_small.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
BIN
packages/Keyguard/res/drawable-xxhdpi/ic_alarm_small.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
@@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- This is a view that shows general status information in Keyguard. -->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/keyguard_status_area"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="-16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="@dimen/kg_status_date_font_size"
|
||||
android:textAllCaps="@bool/kg_use_all_caps"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/alarm_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearance"
|
||||
android:textSize="@dimen/kg_status_line_font_size"
|
||||
android:drawablePadding="4dip"
|
||||
android:textAllCaps="@bool/kg_use_all_caps"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,61 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- This is a view that shows general status information in Keyguard. -->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/keyguard_status_area"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_gravity="right">
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textSize="@dimen/kg_status_date_font_size"
|
||||
android:textAllCaps="@bool/kg_use_all_caps"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/alarm_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearance"
|
||||
android:textSize="@dimen/kg_status_line_font_size"
|
||||
android:drawablePadding="4dip"
|
||||
android:textAllCaps="@bool/kg_use_all_caps"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
50
packages/Keyguard/res/layout/keyguard_status_area.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2013, 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- This is a view that shows general status information in Keyguard. -->
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/res/com.android.keyguard"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
<TextClock android:id="@+id/date_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/clock_white"
|
||||
android:format12Hour="@string/abbrev_wday_month_day_no_year"
|
||||
android:format24Hour="@string/abbrev_wday_month_day_no_year"
|
||||
style="@style/widget_label"
|
||||
android:gravity="center"
|
||||
/>
|
||||
<TextView android:id="@+id/alarm_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="2dip"
|
||||
android:drawableLeft="@drawable/ic_alarm_small"
|
||||
android:drawableStart="@drawable/ic_alarm_small"
|
||||
android:textColor="@color/clock_gray"
|
||||
style="@style/widget_label"
|
||||
android:layout_marginLeft="8dip"
|
||||
android:layout_marginStart="8dip"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</LinearLayout>
|
||||
@@ -35,34 +35,26 @@
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:contentDescription="@string/keyguard_accessibility_status">
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:orientation="vertical"
|
||||
android:focusable="true">
|
||||
<com.android.keyguard.ClockView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:orientation="vertical"
|
||||
android:focusable="true">
|
||||
<TextClock
|
||||
android:id="@+id/clock_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/kg_status_line_font_right_margin"
|
||||
android:layout_gravity="right">
|
||||
|
||||
<TextView android:id="@+id/clock_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="none"
|
||||
android:textSize="@dimen/kg_status_clock_font_size"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="#ffffffff"
|
||||
android:drawablePadding="2dip"
|
||||
/>
|
||||
|
||||
</com.android.keyguard.ClockView>
|
||||
android:layout_gravity="center_horizontal|top"
|
||||
android:textColor="@color/clock_white"
|
||||
android:singleLine="true"
|
||||
style="@style/widget_big_thin"
|
||||
android:format12Hour="@string/keyguard_widget_12_hours_format"
|
||||
android:format24Hour="@string/keyguard_widget_24_hours_format"
|
||||
android:baselineAligned="true"
|
||||
android:layout_marginBottom="@dimen/bottom_text_spacing_digital" />
|
||||
|
||||
<include layout="@layout/keyguard_status_area" />
|
||||
</LinearLayout>
|
||||
|
||||
</com.android.keyguard.KeyguardStatusView>
|
||||
</com.android.keyguard.KeyguardWidgetFrame>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
android:drawablePadding="4dp"
|
||||
android:text="@string/kg_reordering_delete_drop_target_text"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="13sp"
|
||||
android:textSize="12dp"
|
||||
android:shadowColor="#000"
|
||||
android:shadowDy="1.0"
|
||||
android:shadowRadius="1.0"
|
||||
|
||||
@@ -19,17 +19,6 @@
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Default height of a key in the password keyboard for alpha -->
|
||||
<dimen name="password_keyboard_key_height_alpha">47dip</dimen>
|
||||
<!-- Default height of a key in the password keyboard for numeric -->
|
||||
<dimen name="password_keyboard_key_height_numeric">50dip</dimen>
|
||||
<!-- Default correction for the space key in the password keyboard -->
|
||||
<dimen name="password_keyboard_spacebar_vertical_correction">2dip</dimen>
|
||||
<dimen name="preference_widget_width">72dp</dimen>
|
||||
|
||||
<!-- Size of clock font in LockScreen on Unsecure unlock screen. -->
|
||||
<dimen name="keyguard_lockscreen_clock_font_size">70sp</dimen>
|
||||
|
||||
<!-- Shift emergency button from the left edge by this amount. Used by landscape layout on
|
||||
phones -->
|
||||
<dimen name="kg_emergency_button_shift">30dp</dimen>
|
||||
|
||||
@@ -17,13 +17,6 @@
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- Default height of a key in the password keyboard for alpha -->
|
||||
<dimen name="password_keyboard_key_height_alpha">75dip</dimen>
|
||||
<!-- Default height of a key in the password keyboard for numeric -->
|
||||
<dimen name="password_keyboard_key_height_numeric">75dip</dimen>
|
||||
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
|
||||
<dimen name="password_keyboard_height">48.0mm</dimen>
|
||||
|
||||
<!-- Minimum width of the search view text entry area. -->
|
||||
<dimen name="search_view_text_min_width">192dip</dimen>
|
||||
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- Size of clock font in LockScreen. -->
|
||||
<dimen name="keyguard_pattern_unlock_clock_font_size">112sp</dimen>
|
||||
|
||||
<!-- Size of lockscreen outerring on unsecure unlock LockScreen -->
|
||||
<dimen name="keyguard_lockscreen_outerring_diameter">364dp</dimen>
|
||||
|
||||
@@ -37,9 +34,6 @@
|
||||
<!-- Size of the clock font in keyguard's status view -->
|
||||
<dimen name="kg_status_clock_font_size">141dp</dimen>
|
||||
|
||||
<!-- Size of the date font in keyguard's status view -->
|
||||
<dimen name="kg_status_date_font_size">25.5dp</dimen>
|
||||
|
||||
<!-- Size of the generic status lines keyguard's status view -->
|
||||
<dimen name="kg_status_line_font_size">16sp</dimen>
|
||||
|
||||
@@ -68,4 +62,8 @@
|
||||
<!-- Margin around the various security views -->
|
||||
<dimen name="keyguard_muliuser_selector_margin">12dp</dimen>
|
||||
|
||||
<!-- Overload default clock widget parameters -->
|
||||
<dimen name="widget_label_font_size">16dp</dimen>
|
||||
<dimen name="widget_big_font_size">141dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
<!-- Size of the clock font in keyguard's status view -->
|
||||
<dimen name="kg_status_clock_font_size">188dp</dimen>
|
||||
|
||||
<!-- Size of the date font in keyguard's status view -->
|
||||
<dimen name="kg_status_date_font_size">34dp</dimen>
|
||||
|
||||
<!-- Size of the generic status lines keyguard's status view -->
|
||||
<dimen name="kg_status_line_font_size">19sp</dimen>
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/* //device/apps/common/assets/res/any/dimens.xml
|
||||
**
|
||||
** Copyright 2006, 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.
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- Default height of a key in the password keyboard for alpha -->
|
||||
<dimen name="password_keyboard_key_height_alpha">75dip</dimen>
|
||||
<!-- Default height of a key in the password keyboard for numeric -->
|
||||
<dimen name="password_keyboard_key_height_numeric">75dip</dimen>
|
||||
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
|
||||
<dimen name="password_keyboard_height">48.0mm</dimen>
|
||||
</resources>
|
||||
@@ -34,9 +34,6 @@
|
||||
<!-- Alias used to reference framework drawable in keyguard. -->
|
||||
<item type="drawable" name="ic_contact_picture">@*android:drawable/ic_contact_picture</item>
|
||||
|
||||
<!-- Alias used to reference framework drawable in keyguard. -->
|
||||
<item type="drawable" name="ic_lock_idle_alarm">@*android:drawable/ic_lock_idle_alarm</item>
|
||||
|
||||
<!-- Alias used to reference framework "OK" string in keyguard. -->
|
||||
<item type="string" name="ok">@*android:string/ok</item>
|
||||
|
||||
@@ -52,4 +49,4 @@
|
||||
<!-- Alias used to reference framework activity duration. -->
|
||||
<item type="integer" name="config_activityDefaultDur">@*android:integer/config_activityDefaultDur</item>
|
||||
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
@@ -23,4 +23,8 @@
|
||||
|
||||
<!-- FaceLock -->
|
||||
<color name="facelock_spotlight_mask">#CC000000</color>
|
||||
|
||||
<!-- Clock -->
|
||||
<color name="clock_white">#ffffffff</color>
|
||||
<color name="clock_gray">#80ffffff</color>
|
||||
</resources>
|
||||
|
||||
@@ -18,17 +18,6 @@
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- Default height of a key in the password keyboard for alpha (used by keyguard) -->
|
||||
<dimen name="password_keyboard_key_height_alpha">56dip</dimen>
|
||||
<!-- Default height of a key in the password keyboard for numeric (used by keyguard) -->
|
||||
<dimen name="password_keyboard_key_height_numeric">56dip</dimen>
|
||||
<!-- Default correction for the space key in the password keyboard (used by keyguard) -->
|
||||
<dimen name="password_keyboard_spacebar_vertical_correction">4dip</dimen>
|
||||
<!-- Default horizontal gap between keys in the password keyboard (used by keyguard) -->
|
||||
<dimen name="password_keyboard_horizontalGap">3dip</dimen>
|
||||
<!-- Default vertical gap between keys in the password keyboard (used by keyguard) -->
|
||||
<dimen name="password_keyboard_verticalGap">9dip</dimen>
|
||||
|
||||
<!-- Size of lockscreen outerring on unsecure unlock LockScreen -->
|
||||
<dimen name="keyguard_lockscreen_outerring_diameter">270dp</dimen>
|
||||
|
||||
@@ -47,9 +36,6 @@
|
||||
<!-- Default distance from each snap target that GlowPadView considers a "hit" -->
|
||||
<dimen name="glowpadview_inner_radius">15dip</dimen>
|
||||
|
||||
<!-- Size of clock font in LockScreen on Unsecure unlock screen. -->
|
||||
<dimen name="keyguard_lockscreen_clock_font_size">80dip</dimen>
|
||||
|
||||
<!-- Size of status line font on Unsecure unlock LockScreen. -->
|
||||
<dimen name="keyguard_lockscreen_status_line_font_size">14dip</dimen>
|
||||
|
||||
@@ -84,11 +70,8 @@
|
||||
<!-- Size of the clock font in keyguard's status view -->
|
||||
<dimen name="kg_status_clock_font_size">75dp</dimen>
|
||||
|
||||
<!-- Size of the date font in keyguard's status view -->
|
||||
<dimen name="kg_status_date_font_size">15dp</dimen>
|
||||
|
||||
<!-- Size of the generic status lines keyguard's status view -->
|
||||
<dimen name="kg_status_line_font_size">13dp</dimen>
|
||||
<dimen name="kg_status_line_font_size">12dp</dimen>
|
||||
|
||||
<!-- Size of margin on the right of keyguard's status view -->
|
||||
<dimen name="kg_status_line_font_right_margin">16dp</dimen>
|
||||
@@ -166,5 +149,12 @@
|
||||
used on tablets; on phones, this size is determined by the space left by the
|
||||
security mode. -->
|
||||
<dimen name="kg_small_widget_height">160dp</dimen>
|
||||
|
||||
<!-- Default clock parameters -->
|
||||
<dimen name="bottom_text_spacing_digital">-8dp</dimen>
|
||||
<dimen name="label_font_size">14dp</dimen>
|
||||
<dimen name="widget_label_font_size">12dp</dimen>
|
||||
<dimen name="widget_big_font_size">80dp</dimen>
|
||||
<dimen name="big_font_size">120dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
22
packages/Keyguard/res/values/donottranslate.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2013 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.
|
||||
-->
|
||||
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- String matching the lock screen format for displaying the date. -->
|
||||
<string name="abbrev_wday_month_day_no_year">EEE, MMMM d</string>
|
||||
<!-- Format for describing the date, for accessibility. -->
|
||||
<string name="full_wday_month_day_no_year">EEEE, MMMM d</string>
|
||||
</resources>
|
||||
@@ -94,6 +94,10 @@
|
||||
progress dialog in the meantime. this is the emssage. -->
|
||||
<string name="keyguard_sim_unlock_progress_dialog_message">Unlocking SIM card\u2026</string>
|
||||
|
||||
<!-- Time format strings for fall-back clock widget -->
|
||||
<string name="keyguard_widget_12_hours_format" translatable="false">h:mm</string>
|
||||
<!-- Time format strings for fall-back clock widget -->
|
||||
<string name="keyguard_widget_24_hours_format" translatable="false">kk:mm</string>
|
||||
|
||||
<!-- Accessibility description sent when user changes the current lock screen widget. [CHAR_LIMIT=none] -->
|
||||
<string name="keyguard_accessibility_widget_changed">%1$s. Widget %2$d of %3$d.</string>
|
||||
|
||||
@@ -52,5 +52,20 @@
|
||||
<item name="android:windowEnterAnimation">@anim/lock_screen_enter</item>
|
||||
<item name="android:windowExitAnimation">@anim/lock_screen_exit</item>
|
||||
</style>
|
||||
|
||||
<!-- Built-in clock widget stuff -->
|
||||
<style name="widget_label">
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:fontFamily">sans-serif-condensed</item>
|
||||
<item name="android:textSize">@dimen/kg_status_line_font_size</item>
|
||||
</style>
|
||||
<style name="big_thin">
|
||||
<item name="android:textSize">@dimen/big_font_size</item>
|
||||
<item name="android:fontFamily">sans-serif-thin</item>
|
||||
</style>
|
||||
<style name="widget_big_thin" parent="big_thin">
|
||||
<item name="android:textSize">@dimen/widget_big_font_size</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012 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.keyguard;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Handler;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Displays the time
|
||||
*/
|
||||
public class ClockView extends RelativeLayout {
|
||||
private static final String ANDROID_CLOCK_FONT_FILE = "/system/fonts/AndroidClock.ttf";
|
||||
private final static String M12 = "h:mm";
|
||||
private final static String M24 = "HH:mm";
|
||||
|
||||
private Calendar mCalendar;
|
||||
private String mFormat;
|
||||
private TextView mTimeView;
|
||||
private AmPm mAmPm;
|
||||
private ContentObserver mFormatChangeObserver;
|
||||
private int mAttached = 0; // for debugging - tells us whether attach/detach is unbalanced
|
||||
|
||||
/* called by system on minute ticks */
|
||||
private final Handler mHandler = new Handler();
|
||||
private BroadcastReceiver mIntentReceiver;
|
||||
|
||||
private static class TimeChangedReceiver extends BroadcastReceiver {
|
||||
private WeakReference<ClockView> mClock;
|
||||
private Context mContext;
|
||||
|
||||
public TimeChangedReceiver(ClockView clock) {
|
||||
mClock = new WeakReference<ClockView>(clock);
|
||||
mContext = clock.getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
// Post a runnable to avoid blocking the broadcast.
|
||||
final boolean timezoneChanged =
|
||||
intent.getAction().equals(Intent.ACTION_TIMEZONE_CHANGED);
|
||||
final ClockView clock = mClock.get();
|
||||
if (clock != null) {
|
||||
clock.mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
if (timezoneChanged) {
|
||||
clock.mCalendar = Calendar.getInstance();
|
||||
}
|
||||
clock.updateTime();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
try {
|
||||
mContext.unregisterReceiver(this);
|
||||
} catch (RuntimeException e) {
|
||||
// Shouldn't happen
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static class AmPm {
|
||||
private TextView mAmPmTextView;
|
||||
private String mAmString, mPmString;
|
||||
|
||||
AmPm(View parent, Typeface tf) {
|
||||
// No longer used, uncomment if we decide to use AM/PM indicator again
|
||||
// mAmPmTextView = (TextView) parent.findViewById(R.id.am_pm);
|
||||
if (mAmPmTextView != null && tf != null) {
|
||||
mAmPmTextView.setTypeface(tf);
|
||||
}
|
||||
|
||||
String[] ampm = new DateFormatSymbols().getAmPmStrings();
|
||||
mAmString = ampm[0];
|
||||
mPmString = ampm[1];
|
||||
}
|
||||
|
||||
void setShowAmPm(boolean show) {
|
||||
if (mAmPmTextView != null) {
|
||||
mAmPmTextView.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
void setIsMorning(boolean isMorning) {
|
||||
if (mAmPmTextView != null) {
|
||||
mAmPmTextView.setText(isMorning ? mAmString : mPmString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class FormatChangeObserver extends ContentObserver {
|
||||
private WeakReference<ClockView> mClock;
|
||||
private Context mContext;
|
||||
public FormatChangeObserver(ClockView clock) {
|
||||
super(new Handler());
|
||||
mClock = new WeakReference<ClockView>(clock);
|
||||
mContext = clock.getContext();
|
||||
}
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
ClockView digitalClock = mClock.get();
|
||||
if (digitalClock != null) {
|
||||
digitalClock.setDateFormat();
|
||||
digitalClock.updateTime();
|
||||
} else {
|
||||
try {
|
||||
mContext.getContentResolver().unregisterContentObserver(this);
|
||||
} catch (RuntimeException e) {
|
||||
// Shouldn't happen
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ClockView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ClockView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mTimeView = (TextView) findViewById(R.id.clock_text);
|
||||
mTimeView.setTypeface(Typeface.createFromFile(ANDROID_CLOCK_FONT_FILE));
|
||||
mAmPm = new AmPm(this, null);
|
||||
mCalendar = Calendar.getInstance();
|
||||
setDateFormat();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
|
||||
mAttached++;
|
||||
|
||||
/* monitor time ticks, time changed, timezone */
|
||||
if (mIntentReceiver == null) {
|
||||
mIntentReceiver = new TimeChangedReceiver(this);
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_TIME_TICK);
|
||||
filter.addAction(Intent.ACTION_TIME_CHANGED);
|
||||
filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
|
||||
mContext.registerReceiverAsUser(mIntentReceiver, UserHandle.OWNER, filter, null, null );
|
||||
}
|
||||
|
||||
/* monitor 12/24-hour display preference */
|
||||
if (mFormatChangeObserver == null) {
|
||||
mFormatChangeObserver = new FormatChangeObserver(this);
|
||||
mContext.getContentResolver().registerContentObserver(
|
||||
Settings.System.CONTENT_URI, true, mFormatChangeObserver);
|
||||
}
|
||||
|
||||
updateTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
|
||||
mAttached--;
|
||||
|
||||
if (mIntentReceiver != null) {
|
||||
mContext.unregisterReceiver(mIntentReceiver);
|
||||
}
|
||||
if (mFormatChangeObserver != null) {
|
||||
mContext.getContentResolver().unregisterContentObserver(
|
||||
mFormatChangeObserver);
|
||||
}
|
||||
|
||||
mFormatChangeObserver = null;
|
||||
mIntentReceiver = null;
|
||||
}
|
||||
|
||||
void updateTime(Calendar c) {
|
||||
mCalendar = c;
|
||||
updateTime();
|
||||
}
|
||||
|
||||
public void updateTime() {
|
||||
mCalendar.setTimeInMillis(System.currentTimeMillis());
|
||||
|
||||
CharSequence newTime = DateFormat.format(mFormat, mCalendar);
|
||||
mTimeView.setText(newTime);
|
||||
mAmPm.setIsMorning(mCalendar.get(Calendar.AM_PM) == 0);
|
||||
}
|
||||
|
||||
private void setDateFormat() {
|
||||
mFormat = android.text.format.DateFormat.is24HourFormat(getContext()) ? M24 : M12;
|
||||
mAmPm.setShowAmPm(mFormat.equals(M12));
|
||||
}
|
||||
}
|
||||
@@ -38,17 +38,9 @@ public class KeyguardStatusView extends GridLayout {
|
||||
private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
|
||||
private static final String TAG = "KeyguardStatusView";
|
||||
|
||||
public static final int LOCK_ICON = 0; // R.drawable.ic_lock_idle_lock;
|
||||
public static final int ALARM_ICON = R.drawable.ic_lock_idle_alarm;
|
||||
public static final int CHARGING_ICON = 0; //R.drawable.ic_lock_idle_charging;
|
||||
public static final int BATTERY_LOW_ICON = 0; //R.drawable.ic_lock_idle_low_battery;
|
||||
|
||||
private SimpleDateFormat mDateFormat;
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
|
||||
private TextView mDateView;
|
||||
private TextView mAlarmStatusView;
|
||||
private ClockView mClockView;
|
||||
|
||||
private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
|
||||
|
||||
@@ -81,21 +73,12 @@ public class KeyguardStatusView extends GridLayout {
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
Resources res = getContext().getResources();
|
||||
final Locale locale = Locale.getDefault();
|
||||
final String datePattern = res.getString(R.string.system_ui_date_pattern);
|
||||
final String bestFormat = ICU.getBestDateTimePattern(datePattern, locale.toString());
|
||||
mDateFormat = new SimpleDateFormat(bestFormat, locale);
|
||||
mDateView = (TextView) findViewById(R.id.date);
|
||||
|
||||
mAlarmStatusView = (TextView) findViewById(R.id.alarm_status);
|
||||
mClockView = (ClockView) findViewById(R.id.clock_view);
|
||||
mLockPatternUtils = new LockPatternUtils(getContext());
|
||||
|
||||
// Use custom font in mDateView
|
||||
mDateView.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
|
||||
|
||||
// Required to get Marquee to work.
|
||||
final View marqueeViews[] = { mDateView, mAlarmStatusView };
|
||||
final View marqueeViews[] = { mAlarmStatusView };
|
||||
for (int i = 0; i < marqueeViews.length; i++) {
|
||||
View v = marqueeViews[i];
|
||||
if (v == null) {
|
||||
@@ -107,8 +90,6 @@ public class KeyguardStatusView extends GridLayout {
|
||||
}
|
||||
|
||||
protected void refresh() {
|
||||
mClockView.updateTime();
|
||||
refreshDate();
|
||||
refreshAlarmStatus(); // might as well
|
||||
}
|
||||
|
||||
@@ -117,17 +98,12 @@ public class KeyguardStatusView extends GridLayout {
|
||||
String nextAlarm = mLockPatternUtils.getNextAlarm();
|
||||
if (!TextUtils.isEmpty(nextAlarm)) {
|
||||
mAlarmStatusView.setText(nextAlarm);
|
||||
mAlarmStatusView.setCompoundDrawablesWithIntrinsicBounds(ALARM_ICON, 0, 0, 0);
|
||||
mAlarmStatusView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mAlarmStatusView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
void refreshDate() {
|
||||
mDateView.setText(mDateFormat.format(new Date()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
|
||||