diff options
10 files changed, 10 insertions, 222 deletions
diff --git a/java/com/android/dialer/app/res/values/colors.xml b/java/com/android/dialer/app/res/values/colors.xml index bb3662cda..84a381f21 100644 --- a/java/com/android/dialer/app/res/values/colors.xml +++ b/java/com/android/dialer/app/res/values/colors.xml @@ -68,6 +68,7 @@ <color name="dialer_dialpad_touch_tint">@color/dialer_theme_color_20pct</color> <color name="call_log_action_divider">#eeeeee</color> + <color name="divider_line_color">#D8D8D8</color> <!-- Colors for blocked numbers list --> <color name="blocked_number_primary_text_color">@color/dialer_primary_text_color</color> diff --git a/java/com/android/dialer/speeddial/FavoritesViewHolder.java b/java/com/android/dialer/speeddial/FavoritesViewHolder.java index 4e8d4ad07..f9eec8e79 100644 --- a/java/com/android/dialer/speeddial/FavoritesViewHolder.java +++ b/java/com/android/dialer/speeddial/FavoritesViewHolder.java @@ -22,16 +22,12 @@ import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; -import android.support.annotation.VisibleForTesting; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; -import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; import android.widget.FrameLayout; -import android.widget.LinearLayout.LayoutParams; -import android.widget.PopupWindow; import android.widget.QuickContactBadge; import android.widget.TextView; import com.android.dialer.common.Assert; @@ -48,9 +44,6 @@ public class FavoritesViewHolder extends RecyclerView.ViewHolder private final TextView nameView; private final TextView phoneType; private final FrameLayout videoCallIcon; - private final View contextMenuAnchor; - - private PopupWindow contextMenu; private boolean hasDefaultNumber; private boolean isVideoCall; @@ -63,7 +56,6 @@ public class FavoritesViewHolder extends RecyclerView.ViewHolder nameView = view.findViewById(R.id.name); phoneType = view.findViewById(R.id.phone_type); videoCallIcon = view.findViewById(R.id.video_call_container); - contextMenuAnchor = view.findViewById(R.id.avatar_container); view.setOnClickListener(this); view.setOnLongClickListener(this); photoView.setClickable(false); @@ -120,44 +112,12 @@ public class FavoritesViewHolder extends RecyclerView.ViewHolder } @Override - public boolean onLongClick(View view) { - Context context = itemView.getContext(); - View contentView = LayoutInflater.from(context).inflate(R.layout.favorite_context_menu, null); - contentView - .findViewById(R.id.voice_call_container) - .setOnClickListener(v -> listener.onClick(Assert.isNotNull(number), false)); - contentView - .findViewById(R.id.video_call_container) - .setOnClickListener(v -> listener.onClick(Assert.isNotNull(number), true)); - contentView - .findViewById(R.id.send_message_container) - .setOnClickListener(v -> listener.openSmsConversation(Assert.isNotNull(number))); - contentView - .findViewById(R.id.remove_container) - .setOnClickListener(v -> listener.removeFavoriteContact()); - contentView - .findViewById(R.id.contact_info_container) - .setOnClickListener(v -> listener.openContactInfo()); - - int offset = - context.getResources().getDimensionPixelSize(R.dimen.speed_dial_context_menu_x_offset); - int padding = - context.getResources().getDimensionPixelSize(R.dimen.speed_dial_context_menu_extra_width); - int width = padding + itemView.getWidth(); - int elevation = context.getResources().getDimensionPixelSize(R.dimen.context_menu_elevation); - contextMenu = new PopupWindow(contentView, width, LayoutParams.WRAP_CONTENT, true); - contextMenu.setBackgroundDrawable(context.getDrawable(R.drawable.context_menu_background)); - contextMenu.setElevation(elevation); - contextMenu.setOnDismissListener(() -> contextMenu = null); - contextMenu.showAsDropDown(contextMenuAnchor, offset, 0); + public boolean onLongClick(View v) { + // TODO(calderwoodra): implement drag and drop logic + listener.onLongClick(number); return true; } - @VisibleForTesting - public PopupWindow getContextMenu() { - return contextMenu; - } - /** Listener/callback for {@link FavoritesViewHolder} actions. */ public interface FavoriteContactsListener { @@ -167,13 +127,7 @@ public class FavoritesViewHolder extends RecyclerView.ViewHolder /** Called when the user clicks on a favorite contact. */ void onClick(String number, boolean isVideoCall); - /** Called when the user selects send message from the context menu. */ - void openSmsConversation(String number); - - /** Called when the user selects remove from the context menu. */ - void removeFavoriteContact(); - - /** Called when the user selects contact info from the context menu. */ - void openContactInfo(); + /** Called when the user long clicks on a favorite contact. */ + void onLongClick(String number); } } diff --git a/java/com/android/dialer/speeddial/SpeedDialFragment.java b/java/com/android/dialer/speeddial/SpeedDialFragment.java index a75c5ddbd..979c894fe 100644 --- a/java/com/android/dialer/speeddial/SpeedDialFragment.java +++ b/java/com/android/dialer/speeddial/SpeedDialFragment.java @@ -112,18 +112,8 @@ public class SpeedDialFragment extends Fragment { } @Override - public void openSmsConversation(String number) { - // TODO(calderwoodra): open sms conversation - } - - @Override - public void removeFavoriteContact() { - // TODO(calderwoodra): remove contact from favorites - } - - @Override - public void openContactInfo() { - // TODO(calderwoodra): open quick contact info + public void onLongClick(String number) { + // TODO(calderwoodra): show favorite contact floating context menu } } 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 deleted file mode 100644 index fd60757b5..000000000 --- a/java/com/android/dialer/speeddial/res/drawable/context_menu_background.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?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="@android:color/white"/> -</shape> diff --git a/java/com/android/dialer/speeddial/res/layout/favorite_context_menu.xml b/java/com/android/dialer/speeddial/res/layout/favorite_context_menu.xml deleted file mode 100644 index 04d0139e0..000000000 --- a/java/com/android/dialer/speeddial/res/layout/favorite_context_menu.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?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 - --> -<!-- TODO(calderwoodra): fix elevation --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/contact_menu_container" - android:orientation="vertical" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - 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: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"/> - - <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>
\ 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 b4fc9c08d..d432f097b 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 @@ -19,6 +19,6 @@ android:id="@+id/speed_dial_recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingStart="@dimen/speed_dial_recyclerview_horizontal_padding" - android:paddingEnd="@dimen/speed_dial_recyclerview_horizontal_padding" + android:paddingStart="16dp" + android:paddingEnd="16dp" android:clipToPadding="false"/> diff --git a/java/com/android/dialer/speeddial/res/values/dimens.xml b/java/com/android/dialer/speeddial/res/values/dimens.xml index ce2de9dcc..74b509b73 100644 --- a/java/com/android/dialer/speeddial/res/values/dimens.xml +++ b/java/com/android/dialer/speeddial/res/values/dimens.xml @@ -16,19 +16,4 @@ --> <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 666eedea9..677f772c5 100644 --- a/java/com/android/dialer/speeddial/res/values/strings.xml +++ b/java/com/android/dialer/speeddial/res/values/strings.xml @@ -38,21 +38,6 @@ <!-- Text for a button that places a phone/voice call [CHAR LIMIT=15]--> <string name="disambig_option_voice_call">Call</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> - <!-- 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> </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 deleted file mode 100644 index 83bbd09e5..000000000 --- a/java/com/android/dialer/speeddial/res/values/styles.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?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 diff --git a/java/com/android/dialer/theme/res/values/dimens.xml b/java/com/android/dialer/theme/res/values/dimens.xml index 52a7560b3..2b5243ebd 100644 --- a/java/com/android/dialer/theme/res/values/dimens.xml +++ b/java/com/android/dialer/theme/res/values/dimens.xml @@ -50,7 +50,4 @@ <!-- Minimum width for material compliant buttons. --> <dimen name="dialer_button_min_width">72dp</dimen> - - <!-- Color for list dividers --> - <color name="divider_line_color">#D8D8D8</color> </resources> |