Merge changes from topic "emergency_info_provider_related"
am: d27da232b4
Change-Id: I4ccfa0af34416b773f701b8dde62ec195d87f05f
diff --git a/res/drawable-hdpi/ic_arrow_go_next_18.png b/res/drawable-hdpi/ic_arrow_go_next_18.png
new file mode 100644
index 0000000..37cd6df
--- /dev/null
+++ b/res/drawable-hdpi/ic_arrow_go_next_18.png
Binary files differ
diff --git a/res/drawable-hdpi/logo_avatar_anonymous_120.png b/res/drawable-hdpi/logo_avatar_anonymous_120.png
new file mode 100644
index 0000000..70d3011
--- /dev/null
+++ b/res/drawable-hdpi/logo_avatar_anonymous_120.png
Binary files differ
diff --git a/res/drawable-ldrtl-hdpi/ic_arrow_go_next_18.png b/res/drawable-ldrtl-hdpi/ic_arrow_go_next_18.png
new file mode 100644
index 0000000..b8cef90
--- /dev/null
+++ b/res/drawable-ldrtl-hdpi/ic_arrow_go_next_18.png
Binary files differ
diff --git a/res/drawable-ldrtl-mdpi/ic_arrow_go_next_18.png b/res/drawable-ldrtl-mdpi/ic_arrow_go_next_18.png
new file mode 100644
index 0000000..fc0a292
--- /dev/null
+++ b/res/drawable-ldrtl-mdpi/ic_arrow_go_next_18.png
Binary files differ
diff --git a/res/drawable-ldrtl-xhdpi/ic_arrow_go_next_18.png b/res/drawable-ldrtl-xhdpi/ic_arrow_go_next_18.png
new file mode 100644
index 0000000..76c1e7f
--- /dev/null
+++ b/res/drawable-ldrtl-xhdpi/ic_arrow_go_next_18.png
Binary files differ
diff --git a/res/drawable-ldrtl-xxhdpi/ic_arrow_go_next_18.png b/res/drawable-ldrtl-xxhdpi/ic_arrow_go_next_18.png
new file mode 100644
index 0000000..5914ace
--- /dev/null
+++ b/res/drawable-ldrtl-xxhdpi/ic_arrow_go_next_18.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_arrow_go_next_18.png b/res/drawable-mdpi/ic_arrow_go_next_18.png
new file mode 100644
index 0000000..d487ae0
--- /dev/null
+++ b/res/drawable-mdpi/ic_arrow_go_next_18.png
Binary files differ
diff --git a/res/drawable-mdpi/logo_avatar_anonymous_120.png b/res/drawable-mdpi/logo_avatar_anonymous_120.png
new file mode 100644
index 0000000..60d3c3a
--- /dev/null
+++ b/res/drawable-mdpi/logo_avatar_anonymous_120.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_arrow_go_next_18.png b/res/drawable-xhdpi/ic_arrow_go_next_18.png
new file mode 100644
index 0000000..766a889
--- /dev/null
+++ b/res/drawable-xhdpi/ic_arrow_go_next_18.png
Binary files differ
diff --git a/res/drawable-xhdpi/logo_avatar_anonymous_120.png b/res/drawable-xhdpi/logo_avatar_anonymous_120.png
new file mode 100644
index 0000000..ec99ca6
--- /dev/null
+++ b/res/drawable-xhdpi/logo_avatar_anonymous_120.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_arrow_go_next_18.png b/res/drawable-xxhdpi/ic_arrow_go_next_18.png
new file mode 100644
index 0000000..bb4d45e
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_arrow_go_next_18.png
Binary files differ
diff --git a/res/drawable-xxhdpi/logo_avatar_anonymous_120.png b/res/drawable-xxhdpi/logo_avatar_anonymous_120.png
new file mode 100644
index 0000000..2b009a3
--- /dev/null
+++ b/res/drawable-xxhdpi/logo_avatar_anonymous_120.png
Binary files differ
diff --git a/res/drawable/btn_emergency_shortcuts.xml b/res/drawable/btn_emergency_shortcuts.xml
index 8198a57..063a824 100644
--- a/res/drawable/btn_emergency_shortcuts.xml
+++ b/res/drawable/btn_emergency_shortcuts.xml
@@ -15,6 +15,5 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
- <solid android:color="?attr/emergencyButtonBackgroundColor"/>
- <corners android:radius="10dp"/>
+ <corners android:radius="8dp"/>
</shape>
\ No newline at end of file
diff --git a/res/drawable/emergency_shortcuts_divider.xml b/res/drawable/emergency_shortcuts_divider.xml
new file mode 100644
index 0000000..988ffc5
--- /dev/null
+++ b/res/drawable/emergency_shortcuts_divider.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <size android:height="1px"/>
+ <solid android:color="#33FFFFFF"/>
+</shape>
diff --git a/res/layout/emergency_dialer.xml b/res/layout/emergency_dialer.xml
index b98b5c4..cdb9530 100644
--- a/res/layout/emergency_dialer.xml
+++ b/res/layout/emergency_dialer.xml
@@ -24,9 +24,6 @@
android:id="@+id/emergency_dialer_shortcuts"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingLeft="18dp"
- android:paddingRight="18dp"
- android:paddingBottom="@dimen/dialpad_bottom_padding"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
@@ -38,14 +35,14 @@
<FrameLayout
android:id="@+id/dialpad_button_container"
- android:layout_width="@dimen/floating_action_button_width"
- android:layout_height="@dimen/floating_action_button_height"
- android:layout_gravity="bottom|end">
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_gravity="bottom|end"
+ android:layout_margin="@dimen/emergency_dialer_dialpad_button_margin">
<ImageButton
android:id="@+id/floating_action_button_dialpad"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
+ android:layout_width="@dimen/dialpad_button_width"
+ android:layout_height="@dimen/dialpad_button_height"
android:background="@drawable/floating_action_button_red"
android:contentDescription="@string/description_dialpad_button"
android:src="@drawable/ic_dialpad_white_24"/>
diff --git a/res/layout/emergency_information.xml b/res/layout/emergency_information.xml
index c9e9f8b..c4ab74b 100644
--- a/res/layout/emergency_information.xml
+++ b/res/layout/emergency_information.xml
@@ -13,38 +13,65 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<com.android.phone.EmergencyInfoGroup xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/emergency_info_group"
- android:layout_height="wrap_content"
+<com.android.phone.EmergencyInfoGroup
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/emergency_info_button"
+ android:layout_height="@dimen/emergency_info_button_singleline_height"
android:layout_width="match_parent"
- android:layout_marginTop="48dp"
- android:orientation="vertical">
- <TextView
- android:id="@+id/emergency_info_title"
+ android:layout_marginTop="@dimen/emergency_info_button_margin_top">
+ <LinearLayout
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:layout_marginEnd="56dp"
+ android:orientation="horizontal">
+ <FrameLayout
+ android:id="@+id/emergency_info_image_container"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_gravity="center_vertical|start"
+ android:layout_marginHorizontal="@dimen/emergency_dialer_image_margin_horizontal">
+ <ImageView
+ android:id="@+id/emergency_info_image"
+ android:layout_height="@dimen/emergency_info_image_height"
+ android:layout_width="@dimen/emergency_info_image_width"
+ android:scaleType="centerCrop"/>
+ </FrameLayout>
+ <LinearLayout
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:orientation="vertical"
+ android:layout_gravity="center_vertical">
+ <TextView
+ android:id="@+id/emergency_info_name"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:includeFontPadding="false"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:textAppearance="@style/HeadlineTextAppearance"/>
+ <TextView
+ android:id="@+id/emergency_info_hint"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:lineHeight="@dimen/emergency_info_hint_line_height"
+ android:alpha="0.7"
+ android:textAppearance="@style/SubtitleTextAppearance"
+ android:text="@string/emergency_information_hint"/>
+ </LinearLayout>
+ </LinearLayout>
+
+ <FrameLayout
+ android:id="@+id/arrow_go_next_container"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:layout_gravity="start"
- android:paddingBottom="12dp"
- android:textStyle="bold"
- android:text="@string/emergency_information_title"/>
- <LinearLayout
- android:id="@+id/emergency_info_button"
- android:layout_height="64dp"
- android:layout_width="match_parent"
- android:layout_marginTop="2dp"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- android:background="@drawable/btn_emergency_shortcuts">
+ android:layout_gravity="center_vertical|end"
+ android:layout_marginHorizontal="@dimen/emergency_dialer_image_margin_horizontal">
<ImageView
- android:id="@+id/emergency_info_image"
- android:layout_width="40dp"
- android:layout_height="40dp"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"/>
- <TextView
- android:id="@+id/emergency_info_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceButton"/>
- </LinearLayout>
-</com.android.phone.EmergencyInfoGroup>
\ No newline at end of file
+ android:id="@+id/arrow_go_next"
+ android:layout_height="@dimen/emergency_shortcuts_function_icon_height"
+ android:layout_width="@dimen/emergency_shortcuts_function_icon_width"
+ android:src="@drawable/ic_arrow_go_next_18"/>
+ </FrameLayout>
+</com.android.phone.EmergencyInfoGroup>
diff --git a/res/layout/emergency_shortcut_button.xml b/res/layout/emergency_shortcut_button.xml
index 5e30d4e5..6087dba 100644
--- a/res/layout/emergency_shortcut_button.xml
+++ b/res/layout/emergency_shortcut_button.xml
@@ -15,60 +15,68 @@
-->
<com.android.phone.EmergencyShortcutButton
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_height="64dp"
+ android:layout_height="@dimen/emergency_shortcut_button_height"
android:layout_width="match_parent">
<!-- Normal emergency call button view -->
<FrameLayout
android:id="@+id/emergency_call_number_info_view"
android:layout_height="match_parent"
android:layout_width="match_parent"
+ android:background="@color/emergency_shortcut_button_background_color"
android:focusable="true"
android:clickable="true">
<LinearLayout
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:layout_width="wrap_content"
+ android:layout_marginEnd="@dimen/emergency_info_image_width"
android:layout_gravity="center_vertical|start"
- android:gravity="center_vertical"
android:orientation="horizontal">
<FrameLayout
- android:layout_height="40dp"
- android:layout_width="40dp"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
+ android:layout_height="@dimen/phone_number_type_circle_image_height"
+ android:layout_width="@dimen/phone_number_type_circle_image_width"
+ android:layout_gravity="center_vertical"
+ android:layout_marginHorizontal="@dimen/emergency_dialer_image_margin_horizontal"
android:background="@drawable/phone_type_icon_background">
<ImageView
android:id="@+id/phone_type_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="@dimen/phone_number_type_image_height"
+ android:layout_height="@dimen/phone_number_type_image_width"
android:layout_gravity="center"/>
</FrameLayout>
<LinearLayout
android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:gravity="center_vertical|start"
+ android:layout_width="match_parent"
+ android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/phone_number"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:autoSizeTextType="uniform"
+ android:includeFontPadding="false"
android:maxLines="1"
- android:textStyle="bold"
- android:textAppearance="?android:attr/textAppearanceLarge"/>
+ android:ellipsize="end"
+ android:textAppearance="@style/HeadlineTextAppearance"/>
<TextView
android:id="@+id/phone_number_description"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:autoSizeTextType="uniform"
- android:maxLines="1"/>
+ android:alpha="0.8"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:textAppearance="@style/SubtitleTextAppearance"/>
</LinearLayout>
</LinearLayout>
- <ImageView
- android:id="@+id/microphone_icon"
+ <FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:layout_gravity="center_vertical|end"
- android:src="@drawable/fab_ic_call"/>
+ android:layout_marginHorizontal="@dimen/emergency_dialer_image_margin_horizontal"
+ android:layout_gravity="center_vertical|end">
+ <ImageView
+ android:id="@+id/microphone_icon"
+ android:layout_height="@dimen/phone_icon_height"
+ android:layout_width="@dimen/phone_icon_width"
+ android:src="@drawable/ic_emergency_callback_mode"/>
+ </FrameLayout>
</FrameLayout>
<!-- "Tap again to call" view -->
@@ -81,42 +89,48 @@
android:clickable="true"
android:visibility="invisible">
<LinearLayout
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:layout_width="wrap_content"
+ android:layout_marginEnd="@dimen/emergency_info_image_width"
android:layout_gravity="center_vertical|start"
android:gravity="center_vertical"
android:orientation="horizontal">
<FrameLayout
- android:layout_height="40dp"
- android:layout_width="40dp"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
- android:background="@drawable/phone_type_icon_background">
+ android:layout_height="@dimen/phone_number_type_circle_image_height"
+ android:layout_width="@dimen/phone_number_type_circle_image_width"
+ android:layout_marginHorizontal="@dimen/emergency_dialer_image_margin_horizontal"
+ android:background="@drawable/phone_type_icon_background"
+ android:backgroundTint="@android:color/white">
<ImageView
android:id="@+id/confirmed_phone_type_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"/>
+ android:layout_width="@dimen/phone_number_type_image_height"
+ android:layout_height="@dimen/phone_number_type_image_width"
+ android:layout_gravity="center"
+ android:tint="@color/emergency_shortcut_confirm_button_background_color"/>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:gravity="center_vertical|start"
- android:orientation="vertical">
+ android:layout_width="match_parent"
+ android:gravity="center_vertical">
<TextView
android:id="@+id/phone_call_hint"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:autoSizeTextType="uniform"
- android:maxLines="1"
- android:textColor="@android:color/white"
- android:textStyle="italic|bold"/>
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:lineHeight="@dimen/phone_call_hint_line_height"
+ android:textAppearance="@style/ShortcutsHintTextAppearance"/>
</FrameLayout>
</LinearLayout>
- <ImageView
+ <FrameLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
- android:layout_gravity="center_vertical|end"
- android:src="@drawable/fab_ic_call"/>
+ android:layout_marginHorizontal="@dimen/emergency_dialer_image_margin_horizontal"
+ android:layout_gravity="center_vertical|end">
+ <ImageView
+ android:layout_height="@dimen/phone_icon_height"
+ android:layout_width="@dimen/phone_icon_width"
+ android:src="@drawable/ic_emergency_callback_mode"/>
+ </FrameLayout>
</FrameLayout>
</com.android.phone.EmergencyShortcutButton>
\ No newline at end of file
diff --git a/res/layout/emergency_shortcut_buttons_group.xml b/res/layout/emergency_shortcut_buttons_group.xml
index 5ba0533..619eac6 100644
--- a/res/layout/emergency_shortcut_buttons_group.xml
+++ b/res/layout/emergency_shortcut_buttons_group.xml
@@ -18,46 +18,60 @@
android:id="@+id/emergency_shortcut_buttons_group"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:layout_marginTop="58dp"
+ android:layout_marginTop="@dimen/emergency_shortcuts_group_margin_top"
android:orientation="vertical">
<FrameLayout
- android:layout_height="wrap_content"
+ android:id="@+id/emergency_number_title_group"
+ android:layout_height="@dimen/emergency_number_title_height"
android:layout_width="match_parent"
- android:paddingBottom="12dp">
- <TextView
- android:id="@+id/emergency_number_title"
+ android:paddingHorizontal="@dimen/emergency_number_title_group_padding_horizontal">
+ <FrameLayout
+ android:id="@+id/emergency_number_title_container"
android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_gravity="center_vertical|start"
- android:textStyle="bold"
- android:maxLines="1"
- android:text="@string/single_emergency_number_title"/>
+ android:layout_width="@dimen/emergency_number_title_container_width"
+ android:layout_gravity="center_vertical|start">
+ <TextView
+ android:id="@+id/emergency_number_title"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_gravity="start"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:textAppearance="@style/SubtitleTextAppearance"
+ android:text="@string/single_emergency_number_title"/>
+ </FrameLayout>
<LinearLayout
android:id="@+id/location_info"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
+ android:layout_marginStart="@dimen/emergency_number_title_container_width"
android:layout_gravity="center_vertical|end"
android:gravity="center_vertical"
- android:orientation="horizontal">
+ android:orientation="horizontal"
+ android:alpha="0.7">
<ImageView
android:id="@+id/location_icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="@dimen/location_image_width"
+ android:layout_height="@dimen/location_image_height"
android:src="@drawable/ic_location_on_white_18"/>
<TextView
android:id="@+id/location_text"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
+ android:paddingStart="4dp"
android:maxLines="1"
- android:textStyle="italic"/>
+ android:ellipsize="end"
+ android:textAppearance="@style/SubtitleTextAppearance"/>
</LinearLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/emergency_shortcut_buttons_container"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- android:gravity="center"
+ android:layout_marginHorizontal="@dimen/emergency_shortcut_buttons_margin_horizontal"
android:orientation="vertical"
+ android:divider="@drawable/emergency_shortcuts_divider"
+ android:showDividers="middle"
android:background="@drawable/btn_emergency_shortcuts">
</LinearLayout>
</LinearLayout>
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 98ffff7..7136819 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -54,5 +54,6 @@
<color name="dialer_dialpad_touch_tint">#330288d1</color>
<color name="floating_action_button_touch_tint">#80ffffff</color>
+ <color name="emergency_shortcut_button_background_color">#1FFFFFFF</color>
<color name="emergency_shortcut_confirm_button_background_color">#E25142</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 42f9563..97417bd 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -113,4 +113,66 @@
<!-- The size of the "emergency calling unavailable" message shown in the emergency dialer -->
<dimen name="emergency_call_warning_size">16sp</dimen>
+
+ <!-- Horizontal margin for the image on emergency dialer.-->
+ <dimen name="emergency_dialer_image_margin_horizontal">16dp</dimen>
+
+ <!-- Margin of dialpad button -->
+ <dimen name="emergency_dialer_dialpad_button_margin">16dp</dimen>
+
+ <!-- Horizontal margin for button of emergency shortcut. -->
+ <dimen name="emergency_shortcut_buttons_margin_horizontal">16dp</dimen>
+
+ <!-- Margin top of emergency shortcuts group -->
+ <dimen name="emergency_shortcuts_group_margin_top">48dp</dimen>
+
+ <!-- Horizontal padding for group of emergency number title-->
+ <dimen name="emergency_number_title_group_padding_horizontal">16dp</dimen>
+
+ <!-- Height and top margin for the emergency information button. -->
+ <dimen name="emergency_info_button_singleline_height">72dp</dimen>
+ <dimen name="emergency_info_button_margin_top">56dp</dimen>
+ <dimen name="emergency_info_button_multiline_height">90dp</dimen>
+
+ <!-- The height and width for the image of emergency information. -->
+ <dimen name="emergency_info_image_height">56dp</dimen>
+ <dimen name="emergency_info_image_width">56dp</dimen>
+
+ <!-- The height and width for the function icon of emergency shortcuts. -->
+ <dimen name="emergency_shortcuts_function_icon_height">24dp</dimen>
+ <dimen name="emergency_shortcuts_function_icon_width">24dp</dimen>
+
+ <!-- The height and width for the dialpad button -->
+ <dimen name="dialpad_button_height">56dp</dimen>
+ <dimen name="dialpad_button_width">56dp</dimen>
+
+ <!-- The height for title of emergency number and location info. -->
+ <dimen name="emergency_number_title_height">48dp</dimen>
+
+ <!-- The height and width for the image of location info.-->
+ <dimen name="location_image_height">15dp</dimen>
+ <dimen name="location_image_width">15dp</dimen>
+
+ <!-- The height for button of emergency shortcut. -->
+ <dimen name="emergency_shortcut_button_height">80dp</dimen>
+
+ <!-- The height and width for the circle image of phone number type.-->
+ <dimen name="phone_number_type_circle_image_height">40dp</dimen>
+ <dimen name="phone_number_type_circle_image_width">40dp</dimen>
+
+ <!-- The height and width for the image of phone number type.-->
+ <dimen name="phone_number_type_image_height">24dp</dimen>
+ <dimen name="phone_number_type_image_width">24dp</dimen>
+
+ <!-- The height and width of phone icon.-->
+ <dimen name="phone_icon_height">24dp</dimen>
+ <dimen name="phone_icon_width">24dp</dimen>
+
+ <!-- The line height for emergency info hint and phone call hint.-->
+ <dimen name="emergency_info_hint_line_height">17dp</dimen>
+ <dimen name="phone_call_hint_line_height">20dp</dimen>
+
+ <!-- The width for emergency number title container.-->
+ <dimen name="emergency_number_title_container_width">210dp</dimen>
+
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2bce34b..b60d85f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1122,8 +1122,10 @@
<!-- In-call screen: call failure message displayed in an error dialog when the user is connected to a wireless network, but wifi calling is turned off. [CHAR_LIMIT=NONE] -->
<string name="incall_error_promote_wfc">Enable Wi-Fi calling to make a call.</string>
- <!-- Title for the button of emergency information -->
- <string name="emergency_information_title">Emergency information</string>
+ <!-- Hint for the button of emergency information -->
+ <string name="emergency_information_hint">Emergency information</string>
+ <!-- Hint for the owner of emergency information -->
+ <string name="emergency_information_owner_hint">Owner</string>
<!-- Dialog title for the "radio enable" UI for emergency calls -->
<string name="emergency_enable_radio_dialog_title">Emergency call</string>
<!-- Title for the emergency dialpad UI -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index d003aec..73b5c40 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -313,4 +313,17 @@
<style name="CallSettingsWithoutDividerTheme" parent="SettingsLight">
<item name="android:listDivider">@null</item>
</style>
+
+ <style name="HeadlineTextAppearance">
+ <item name="android:textColor">@android:color/white</item>
+ <item name="android:textSize">24sp</item>
+ </style>
+
+ <style name="SubtitleTextAppearance" parent="@style/HeadlineTextAppearance">
+ <item name="android:textSize">14sp</item>
+ </style>
+
+ <style name="ShortcutsHintTextAppearance" parent="@style/HeadlineTextAppearance">
+ <item name="android:textSize">16sp</item>
+ </style>
</resources>
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index ea9eae1..fc4ef6a 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -28,6 +28,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.graphics.Color;
import android.graphics.Point;
import android.media.AudioManager;
import android.media.ToneGenerator;
@@ -40,6 +41,7 @@
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneNumberUtils;
+import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -130,6 +132,9 @@
/** 90% opacity, different from other gradients **/
private static final int BACKGROUND_GRADIENT_ALPHA = 230;
+ /** 85% opacity for black background **/
+ private static final int BLACK_BACKGROUND_GRADIENT_ALPHA = 217;
+
ResizingTextEditText mDigits;
private View mDialButton;
private View mDelete;
@@ -207,10 +212,20 @@
// Allow turning screen on
setTurnScreenOn(true);
+ mAreEmergencyDialerShortcutsEnabled = Settings.Global.getInt(getContentResolver(),
+ Settings.Global.FASTER_EMERGENCY_PHONE_CALL_ENABLED, 0) != 0;
+
mColorExtractor = new ColorExtractor(this);
- GradientColors lockScreenColors = mColorExtractor.getColors(WallpaperManager.FLAG_LOCK,
- ColorExtractor.TYPE_EXTRA_DARK);
- updateTheme(lockScreenColors.supportsDarkText());
+
+ // It does not support dark text theme, when emergency dialer shortcuts are enabled.
+ // And the background color is black with 85% opacity.
+ if (mAreEmergencyDialerShortcutsEnabled) {
+ updateTheme(false);
+ } else {
+ GradientColors lockScreenColors = mColorExtractor.getColors(WallpaperManager.FLAG_LOCK,
+ ColorExtractor.TYPE_EXTRA_DARK);
+ updateTheme(lockScreenColors.supportsDarkText());
+ }
setContentView(R.layout.emergency_dialer);
@@ -228,7 +243,8 @@
((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay().getSize(displaySize);
mBackgroundGradient.setScreenSize(displaySize.x, displaySize.y);
- mBackgroundGradient.setAlpha(BACKGROUND_GRADIENT_ALPHA);
+ mBackgroundGradient.setAlpha(mAreEmergencyDialerShortcutsEnabled
+ ? BLACK_BACKGROUND_GRADIENT_ALPHA : BACKGROUND_GRADIENT_ALPHA);
getWindow().setBackgroundDrawable(mBackgroundGradient);
// Check for the presence of the keypad
@@ -294,9 +310,6 @@
mEmergencyActionGroup = (EmergencyActionGroup) findViewById(R.id.emergency_action_group);
- mAreEmergencyDialerShortcutsEnabled = Settings.Global.getInt(getContentResolver(),
- Settings.Global.FASTER_EMERGENCY_PHONE_CALL_ENABLED, 0) != 0;
-
if (mAreEmergencyDialerShortcutsEnabled) {
setupEmergencyShortcutsView();
}
@@ -358,7 +371,7 @@
@Override
public void onBackPressed() {
// If emergency dialer shortcut is enabled and Dialpad view is visible, pressing the
- // back key will back to display FasterEmergencyDialer view.
+ // back key will back to display EmergencyShortcutView view.
// Otherwise, it would finish the activity.
if (mAreEmergencyDialerShortcutsEnabled && mDialpadView != null
&& mDialpadView.getVisibility() == View.VISIBLE) {
@@ -428,7 +441,7 @@
String phoneNumber = button.getPhoneNumber();
if (!TextUtils.isEmpty(phoneNumber)) {
- Log.d(LOG_TAG, "dial emergency number: " + phoneNumber);
+ if (DBG) Log.d(LOG_TAG, "dial emergency number: " + Rlog.pii(LOG_TAG, phoneNumber));
TelecomManager tm = (TelecomManager) getSystemService(TELECOM_SERVICE);
tm.placeCall(Uri.fromParts(PhoneAccount.SCHEME_TEL, phoneNumber, null), null);
} else {
@@ -455,6 +468,7 @@
return;
}
case R.id.floating_action_button_dialpad: {
+ mDigits.getText().clear();
switchView(mDialpadView, mEmergencyShortcutView, true);
return;
}
@@ -560,13 +574,19 @@
@Override
protected void onStart() {
super.onStart();
-
- mColorExtractor.addOnColorsChangedListener(this);
- GradientColors lockScreenColors = mColorExtractor.getColors(WallpaperManager.FLAG_LOCK,
- ColorExtractor.TYPE_EXTRA_DARK);
- // Do not animate when view isn't visible yet, just set an initial state.
- mBackgroundGradient.setColors(lockScreenColors, false);
- updateTheme(lockScreenColors.supportsDarkText());
+ // It does not support dark text theme, when emergency dialer shortcuts are enabled.
+ // And set background color to black.
+ if (mAreEmergencyDialerShortcutsEnabled) {
+ mBackgroundGradient.setColors(Color.BLACK, Color.BLACK, false);
+ updateTheme(false);
+ } else {
+ mColorExtractor.addOnColorsChangedListener(this);
+ GradientColors lockScreenColors = mColorExtractor.getColors(WallpaperManager.FLAG_LOCK,
+ ColorExtractor.TYPE_EXTRA_DARK);
+ // Do not animate when view isn't visible yet, just set an initial state.
+ mBackgroundGradient.setColors(lockScreenColors, false);
+ updateTheme(lockScreenColors.supportsDarkText());
+ }
}
@Override
@@ -602,7 +622,6 @@
@Override
protected void onStop() {
super.onStop();
-
mColorExtractor.removeOnColorsChangedListener(this);
}
diff --git a/src/com/android/phone/EmergencyInfoGroup.java b/src/com/android/phone/EmergencyInfoGroup.java
index 8100a5a..d0dc322 100644
--- a/src/com/android/phone/EmergencyInfoGroup.java
+++ b/src/com/android/phone/EmergencyInfoGroup.java
@@ -25,8 +25,10 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.telephony.TelephonyManager;
+import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
+import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -42,11 +44,10 @@
* EmergencyInfoGroup display user icon and user name. And it is an entry point to
* Emergency Information.
*/
-public class EmergencyInfoGroup extends LinearLayout {
-
+public class EmergencyInfoGroup extends FrameLayout {
private ImageView mEmergencyInfoImage;
private TextView mEmergencyInfoName;
- private View mEmergencyInfoTitle;
+ private TextView mEmergencyInfoHint;
private View mEmergencyInfoButton;
public EmergencyInfoGroup(Context context, @Nullable AttributeSet attrs) {
@@ -56,10 +57,10 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mEmergencyInfoTitle = findViewById(R.id.emergency_info_title);
mEmergencyInfoButton = findViewById(R.id.emergency_info_button);
mEmergencyInfoImage = (ImageView) findViewById(R.id.emergency_info_image);
mEmergencyInfoName = (TextView) findViewById(R.id.emergency_info_name);
+ mEmergencyInfoHint = (TextView) findViewById(R.id.emergency_info_hint);
}
@Override
@@ -70,6 +71,12 @@
}
}
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+ updateLayoutHeight();
+ }
+
private void setupButtonInfo() {
List<ResolveInfo> infos;
@@ -88,23 +95,18 @@
mEmergencyInfoButton.setTag(R.id.tag_intent, intent);
mEmergencyInfoImage.setImageDrawable(getCircularUserIcon());
- /* TODO: Get user name.
- if user name exist:
- 1. mEmergencyInfoTitle show title.
- 2. mEmergencyInfoName show user name.
- if user name does not exist:
- 1. mEmergencyInfoTitle hide.
- 2. mEmergencyInfoName show app label. */
- mEmergencyInfoTitle.setVisibility(View.INVISIBLE);
- mEmergencyInfoName.setText(getContext().getResources().getString(
- R.string.emergency_information_title));
-
visible = true;
}
+ mEmergencyInfoName.setText(getUserName());
setVisibility(visible ? View.VISIBLE : View.GONE);
}
+ /**
+ * Get user icon.
+ *
+ * @return user icon, or default user icon if user do not set photo.
+ */
private Drawable getCircularUserIcon() {
final UserManager userManager = (UserManager) getContext().getSystemService(
Context.USER_SERVICE);
@@ -113,14 +115,34 @@
if (bitmapUserIcon == null) {
// get default user icon.
final Drawable defaultUserIcon = UserIcons.getDefaultUserIcon(
- getContext().getResources(), UserHandle.getCallingUserId(), false);
+ getContext().getResources(), UserHandle.myUserId(), false);
bitmapUserIcon = UserIcons.convertToBitmap(defaultUserIcon);
}
-
RoundedBitmapDrawable drawableUserIcon = RoundedBitmapDrawableFactory.create(
getContext().getResources(), bitmapUserIcon);
drawableUserIcon.setCircular(true);
return drawableUserIcon;
}
-}
+
+ private CharSequence getUserName() {
+ final UserManager userManager = (UserManager) getContext().getSystemService(
+ Context.USER_SERVICE);
+ final String userName = userManager.getUserName();
+
+ return TextUtils.isEmpty(userName) ? getContext().getText(
+ R.string.emergency_information_owner_hint) : userName;
+ }
+
+ private void updateLayoutHeight() {
+ LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) getLayoutParams();
+ // Update height if mEmergencyInfoHint text line more than 1.
+ // EmergencyInfoGroup max line is 2, eclipse type "end" will be adopt if string too long.
+ params.height =
+ mEmergencyInfoHint.getLineCount() > 1 ? getResources().getDimensionPixelSize(
+ R.dimen.emergency_info_button_multiline_height)
+ : getResources().getDimensionPixelSize(
+ R.dimen.emergency_info_button_singleline_height);
+ setLayoutParams(params);
+ }
+}
\ No newline at end of file