diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-04-12 06:14:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-04-12 06:14:53 +0000 |
commit | 165dc1de6528e0648034f1c495b6f63ae39acfef (patch) | |
tree | 352e4063bb756866db3e878dbb1bec933c71af5c /java/com/android/dialer/speeddial/res | |
parent | d0c86ba608484d8e9307417d2546220b38ab6f10 (diff) | |
parent | 7be061ae13582b0c64251d99a206589a6901bf20 (diff) |
Merge "Added context menu for favorite contacts in new speed dial."
Diffstat (limited to 'java/com/android/dialer/speeddial/res')
6 files changed, 203 insertions, 7 deletions
diff --git a/java/com/android/dialer/speeddial/res/drawable/context_menu_background.xml b/java/com/android/dialer/speeddial/res/drawable/context_menu_background.xml new file mode 100644 index 000000000..c828860b2 --- /dev/null +++ b/java/com/android/dialer/speeddial/res/drawable/context_menu_background.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2017 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"> + <corners + android:bottomRightRadius="@dimen/speed_dial_context_menu_corner_radius" + android:topRightRadius="@dimen/speed_dial_context_menu_corner_radius" + android:bottomLeftRadius="@dimen/speed_dial_context_menu_corner_radius" + android:topLeftRadius="@dimen/speed_dial_context_menu_corner_radius"/> + <solid android:color="@color/background_dialer_white"/> + <stroke android:color="#0333" android:width="2dp"/> +</shape>
\ No newline at end of file diff --git a/java/com/android/dialer/speeddial/res/layout/context_menu_layout.xml b/java/com/android/dialer/speeddial/res/layout/context_menu_layout.xml new file mode 100644 index 000000000..4fb12ffe9 --- /dev/null +++ b/java/com/android/dialer/speeddial/res/layout/context_menu_layout.xml @@ -0,0 +1,95 @@ +<?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 + --> +<com.android.dialer.speeddial.ContextMenu + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/contact_menu_container" + android:orientation="vertical" + android:layout_width="160dp" + android:layout_height="wrap_content" + android:elevation="8dp" + android:clipChildren="true" + android:clipToPadding="false"> + + <FrameLayout + android:layout_width="12dp" + android:layout_height="12dp" + android:layout_marginTop="7dp" + android:layout_marginBottom="-6dp" + android:layout_gravity="center_horizontal" + android:background="@color/background_dialer_white" + android:rotation="45" + android:clipChildren="false" + android:clipToPadding="false"/> + + <LinearLayout + android:id="@+id/context_menu_items_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:background="@drawable/context_menu_background"> + + + <TextView + android:id="@+id/voice_call_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/contact_menu_voice_call" + android:drawableStart="@drawable/quantum_ic_phone_vd_theme_24" + style="@style/SpeedDialContextMenuItem"/> + + <TextView + android:id="@+id/video_call_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/contact_menu_video_call" + android:drawableStart="@drawable/quantum_ic_videocam_vd_theme_24" + style="@style/SpeedDialContextMenuItem"/> + + <TextView + android:id="@+id/send_message_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingBottom="4dp" + android:text="@string/contact_menu_message" + android:drawableStart="@drawable/quantum_ic_message_vd_theme_24" + style="@style/SpeedDialContextMenuItem"/> + + <View + android:id="@+id/divider" + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/divider_line_color"/> + + <TextView + android:id="@+id/remove_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:text="@string/contact_menu_remove" + android:drawableStart="@drawable/quantum_ic_close_vd_theme_24" + style="@style/SpeedDialContextMenuItem"/> + + <!-- TODO(calderwoodra): Update this icon to be the contact icon. --> + <TextView + android:id="@+id/contact_info_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/contact_menu_contact_info" + android:drawableStart="@drawable/quantum_ic_call_vd_theme_24" + style="@style/SpeedDialContextMenuItem"/> + </LinearLayout> +</com.android.dialer.speeddial.ContextMenu>
\ No newline at end of file diff --git a/java/com/android/dialer/speeddial/res/layout/fragment_speed_dial.xml b/java/com/android/dialer/speeddial/res/layout/fragment_speed_dial.xml index 67ef877ca..080fba5d3 100644 --- a/java/com/android/dialer/speeddial/res/layout/fragment_speed_dial.xml +++ b/java/com/android/dialer/speeddial/res/layout/fragment_speed_dial.xml @@ -14,11 +14,29 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License --> -<android.support.v7.widget.RecyclerView - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/speed_dial_recycler_view" +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/speed_dial_root" android:layout_width="match_parent" - android:layout_height="match_parent" - android:clipToPadding="false" - android:background="@color/background_dialer_light" - android:paddingBottom="@dimen/floating_action_button_list_bottom_padding"/> + android:layout_height="match_parent"> + + <android.support.v7.widget.RecyclerView + android:id="@+id/speed_dial_recycler_view" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipToPadding="false" + android:background="@color/background_dialer_light" + android:paddingBottom="@dimen/floating_action_button_list_bottom_padding"/> + + <FrameLayout + android:id="@+id/context_menu_background" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="invisible"/> + + <!-- This menu is visible when you long click on a favorite contact. --> + <include + android:id="@+id/favorite_contact_context_menu" + layout="@layout/context_menu_layout" + android:visibility="invisible"/> +</FrameLayout> + diff --git a/java/com/android/dialer/speeddial/res/values/dimens.xml b/java/com/android/dialer/speeddial/res/values/dimens.xml index 74b509b73..ce2de9dcc 100644 --- a/java/com/android/dialer/speeddial/res/values/dimens.xml +++ b/java/com/android/dialer/speeddial/res/values/dimens.xml @@ -16,4 +16,19 @@ --> <resources> <dimen name="scrollview_max_height">280dp</dimen> + <dimen name="speed_dial_context_menu_width">200dp</dimen> + <dimen name="context_menu_elevation">4dp</dimen> + <dimen name="speed_dial_recyclerview_horizontal_padding">16dp</dimen> + + <!-- + ~ This value expands the context menu to allow space for more text w/o being flush with the edge + ~ of the screen. Calculated with 2 * (speed_dial_recyclerview_horizontal_padding - 2dp) + --> + <dimen name="speed_dial_context_menu_extra_width">28dp</dimen> + <!-- + ~ This value centers the context menu with the favorite item layout. + ~ Calculated with -1 * (speed_dial_context_menu_extra_width * 1.75) + --> + <dimen name="speed_dial_context_menu_x_offset">-24dp</dimen> + <dimen name="speed_dial_context_menu_corner_radius">16dp</dimen> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/speeddial/res/values/strings.xml b/java/com/android/dialer/speeddial/res/values/strings.xml index 677f772c5..59a0ab5d6 100644 --- a/java/com/android/dialer/speeddial/res/values/strings.xml +++ b/java/com/android/dialer/speeddial/res/values/strings.xml @@ -40,4 +40,19 @@ <!-- Title for screen prompting the user to select a contact to mark as a favorite. [CHAR LIMIT=NONE] --> <string name="add_favorite_activity_title">Add Favorite</string> + + <!-- Text for a button that places a phone/voice call [CHAR LIMIT=15]--> + <string name="contact_menu_voice_call">Voice Call</string> + + <!-- Text for a button that places a video call [CHAR LIMIT=15]--> + <string name="contact_menu_video_call">Video Call</string> + + <!-- Text for a button that opens the contact in the SMS app [CHAR LIMIT=15]--> + <string name="contact_menu_message">Message</string> + + <!-- Text for a button that removes the item from the list [CHAR LIMIT=15]--> + <string name="contact_menu_remove">Remove</string> + + <!-- Text for a button that opens the contact's info [CHAR LIMIT=15]--> + <string name="contact_menu_contact_info">Contact info</string> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/speeddial/res/values/styles.xml b/java/com/android/dialer/speeddial/res/values/styles.xml new file mode 100644 index 000000000..83bbd09e5 --- /dev/null +++ b/java/com/android/dialer/speeddial/res/values/styles.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2017 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> + <style name="SpeedDialContextMenuItem" parent="SecondaryText"> + <item name="android:paddingStart">12dp</item> + <item name="android:minHeight">48dp</item> + <item name="android:gravity">center_vertical</item> + <item name="android:drawableTint">@color/secondary_text_color</item> + <item name="android:drawablePadding">12dp</item> + <item name="android:clickable">true</item> + <item name="android:background">?android:attr/selectableItemBackground</item> + </style> +</resources>
\ No newline at end of file |