summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-06-03 07:27:01 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-06-03 07:27:01 +0000
commit493dacb27d8dc040490b6b4e03d447f8b6d9309d (patch)
tree88e6e947a6e1b647144bc707d91c8021d6e47630
parentef9f6403073a790741fac3e13a4b4398f7f72ff9 (diff)
parentf364a0f31b22d32a113e8c63f3f9dbd23622c270 (diff)
downloadDialer-493dacb27d8dc040490b6b4e03d447f8b6d9309d.tar.gz
Snap for 4818534 from f364a0f31b22d32a113e8c63f3f9dbd23622c270 to pi-release
Change-Id: Ib094e1a42cd3b4462014a7a68df262c8ddbae54d
-rw-r--r--Android.mk1
-rw-r--r--res/drawable/car_card_rounded_bottom_background.xml22
-rw-r--r--res/drawable/car_card_rounded_top_background.xml22
-rw-r--r--res/drawable/car_card_rounded_top_bottom_background.xml21
-rw-r--r--src/com/android/car/dialer/ContactDetailsFragment.java31
-rw-r--r--src/com/android/car/dialer/ContactResultViewHolder.java5
6 files changed, 5 insertions, 97 deletions
diff --git a/Android.mk b/Android.mk
index 9b5987ec..c7270114 100644
--- a/Android.mk
+++ b/Android.mk
@@ -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();