diff options
author | Yuzhou Jia <jiayuzhou@google.com> | 2018-06-01 21:09:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-06-01 21:09:27 +0000 |
commit | f364a0f31b22d32a113e8c63f3f9dbd23622c270 (patch) | |
tree | 88e6e947a6e1b647144bc707d91c8021d6e47630 | |
parent | d11c8c101d78b6cd77ed2f60255aef2f3dbe59ef (diff) | |
parent | b7e907df6679d71e48e7dcc13838dcb60245d385 (diff) | |
download | platform_packages_apps_Car_Dialer-f364a0f31b22d32a113e8c63f3f9dbd23622c270.tar.gz platform_packages_apps_Car_Dialer-f364a0f31b22d32a113e8c63f3f9dbd23622c270.tar.bz2 platform_packages_apps_Car_Dialer-f364a0f31b22d32a113e8c63f3f9dbd23622c270.zip |
Merge "DO NOT MERGE Remove the car-stream-lib dependency from Dialer. Replace with the one in car support lib." into pi-dev
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | res/drawable/car_card_rounded_bottom_background.xml | 22 | ||||
-rw-r--r-- | res/drawable/car_card_rounded_top_background.xml | 22 | ||||
-rw-r--r-- | res/drawable/car_card_rounded_top_bottom_background.xml | 21 | ||||
-rw-r--r-- | src/com/android/car/dialer/ContactDetailsFragment.java | 31 | ||||
-rw-r--r-- | src/com/android/car/dialer/ContactResultViewHolder.java | 5 |
6 files changed, 5 insertions, 97 deletions
@@ -38,7 +38,6 @@ LOCAL_STATIC_ANDROID_LIBRARIES += \ android-support-v4 \ android-support-v7-cardview \ car-apps-common \ - car-stream-ui-lib \ LOCAL_STATIC_JAVA_LIBRARIES := \ android-support-constraint-layout-solver \ diff --git a/res/drawable/car_card_rounded_bottom_background.xml b/res/drawable/car_card_rounded_bottom_background.xml deleted file mode 100644 index d0249f9a..00000000 --- a/res/drawable/car_card_rounded_bottom_background.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?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"> - <solid android:color="?attr/listItemBackgroundColor"/> - <corners - android:bottomRightRadius="@dimen/car_radius_3" - android:bottomLeftRadius="@dimen/car_radius_3"/> -</shape>
\ No newline at end of file diff --git a/res/drawable/car_card_rounded_top_background.xml b/res/drawable/car_card_rounded_top_background.xml deleted file mode 100644 index ed52a59e..00000000 --- a/res/drawable/car_card_rounded_top_background.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?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"> - <solid android:color="?attr/listItemBackgroundColor"/> - <corners - android:topRightRadius="@dimen/car_radius_3" - android:topLeftRadius="@dimen/car_radius_3"/> -</shape>
\ No newline at end of file diff --git a/res/drawable/car_card_rounded_top_bottom_background.xml b/res/drawable/car_card_rounded_top_bottom_background.xml deleted file mode 100644 index 7891fd1c..00000000 --- a/res/drawable/car_card_rounded_top_bottom_background.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?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"> - <solid android:color="@color/car_card" /> - <corners - android:radius="@dimen/car_radius_3"/> -</shape> diff --git a/src/com/android/car/dialer/ContactDetailsFragment.java b/src/com/android/car/dialer/ContactDetailsFragment.java index 93284154..bb3b1b5c 100644 --- a/src/com/android/car/dialer/ContactDetailsFragment.java +++ b/src/com/android/car/dialer/ContactDetailsFragment.java @@ -40,6 +40,7 @@ import com.android.car.dialer.telecom.TelecomUtils; import java.util.ArrayList; import java.util.List; +import androidx.car.utils.ListItemBackgroundResolver; import androidx.car.widget.DayNightStyle; import androidx.car.widget.PagedListView; @@ -330,36 +331,8 @@ public class ContactDetailsFragment extends Fragment } else { viewHolder.divier.setVisibility(View.VISIBLE); } - setBackground(viewHolder.card, + ListItemBackgroundResolver.setBackground(viewHolder.card, viewHolder.getAdapterPosition(), getItemCount()); } } - - private void setBackground(View view, int currentPosition, int totalItems) { - if (currentPosition < 0) { - throw new IllegalArgumentException("currentPosition cannot be less than zero."); - } - - if (currentPosition >= totalItems) { - throw new IndexOutOfBoundsException("currentPosition: " + currentPosition + "; " - + "totalItems: " + totalItems); - } - - // Correctly set the background for each card. Only the top and last card should - // have rounded corners. - if (totalItems == 1) { - // One card - all corners are rounded - view.setBackgroundResource( - R.drawable.car_card_rounded_top_bottom_background); - } else if (currentPosition == 0) { - // First card gets rounded top - view.setBackgroundResource(R.drawable.car_card_rounded_top_background); - } else if (currentPosition == totalItems - 1) { - // Last one has a rounded bottom - view.setBackgroundResource(R.drawable.car_card_rounded_bottom_background); - } else { - // Middle has no rounded corners - view.setBackgroundResource(R.color.phone_theme); - } - } } diff --git a/src/com/android/car/dialer/ContactResultViewHolder.java b/src/com/android/car/dialer/ContactResultViewHolder.java index 2a739441..00766e1f 100644 --- a/src/com/android/car/dialer/ContactResultViewHolder.java +++ b/src/com/android/car/dialer/ContactResultViewHolder.java @@ -27,9 +27,10 @@ import android.view.View; import android.widget.ImageView; import android.widget.TextView; +import androidx.car.utils.ListItemBackgroundResolver; + import com.android.car.apps.common.LetterTileDrawable; import com.android.car.dialer.ui.CircleBitmapDrawable; -import com.android.car.view.CardListBackgroundResolver; import java.io.FileNotFoundException; import java.io.InputStream; @@ -57,7 +58,7 @@ public class ContactResultViewHolder extends RecyclerView.ViewHolder { * provided {@link ContactDetails}. */ public void bind(ContactDetails details, int itemCount) { - CardListBackgroundResolver.setBackground(mContactCard, getAdapterPosition(), itemCount); + ListItemBackgroundResolver.setBackground(mContactCard, getAdapterPosition(), itemCount); mContactCard.setOnClickListener(v -> { Intent intent = new Intent(); |