summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Chen <ajchen@google.com>2018-04-30 15:32:13 -0700
committerAnthony Chen <ajchen@google.com>2018-05-02 14:22:10 -0700
commit1a3bec341419ad5741f4efc23bfd5144dccf56e1 (patch)
treecd9ba54caf0420ee4ebd2b56e5212657fc33eda4
parent9fbc1333f54984d799e91f858e37f72dcfcfca3d (diff)
downloadplatform_packages_apps_Car_Dialer-1a3bec341419ad5741f4efc23bfd5144dccf56e1.tar.gz
platform_packages_apps_Car_Dialer-1a3bec341419ad5741f4efc23bfd5144dccf56e1.tar.bz2
platform_packages_apps_Car_Dialer-1a3bec341419ad5741f4efc23bfd5144dccf56e1.zip
DO NOT MERGE Update after adjustment of depenencies in car-apps-common.
car-apps-common has been changed so that it no longer depends on support libraries. To accomplish this, the dependent files that require support library have been migrated direclty into Dialer. These files were only being used by Dialer. Bug: 78886311 Test: build and deploy Dialer Change-Id: Iec047b6580e772782279902755b455fe5e190322
-rw-r--r--Android.mk5
-rw-r--r--res/drawable/car_list_item_background.xml22
-rw-r--r--res/layout/ongoing_call.xml32
-rw-r--r--res/values-h480dp/dimens.xml18
-rw-r--r--res/values-h600dp/dimens.xml2
-rw-r--r--res/values-night/colors.xml3
-rw-r--r--res/values/colors.xml13
-rw-r--r--res/values/dimens.xml3
-rw-r--r--res/values/styles.xml11
-rw-r--r--src/com/android/car/dialer/ContactResultViewHolder.java2
-rw-r--r--src/com/android/car/dialer/OngoingCallFragment.java2
-rw-r--r--src/com/android/car/dialer/telecom/TelecomUtils.java2
-rw-r--r--src/com/android/car/dialer/ui/CircleBitmapDrawable.java115
-rw-r--r--src/com/android/car/dialer/ui/InCallFragment.java5
-rw-r--r--src/com/android/car/dialer/ui/listitem/CallLogListItem.java2
-rw-r--r--src/com/android/car/dialer/ui/listitem/ContactListItem.java2
16 files changed, 212 insertions, 27 deletions
diff --git a/Android.mk b/Android.mk
index c4084f7e..9b5987ec 100644
--- a/Android.mk
+++ b/Android.mk
@@ -33,11 +33,12 @@ LOCAL_USE_AAPT2 := true
LOCAL_STATIC_ANDROID_LIBRARIES += \
android-support-car \
- car-apps-common \
- car-stream-ui-lib \
android-arch-lifecycle-extensions \
android-support-constraint-layout \
+ 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_list_item_background.xml b/res/drawable/car_list_item_background.xml
new file mode 100644
index 00000000..cbc97c7a
--- /dev/null
+++ b/res/drawable/car_list_item_background.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 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.
+-->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/car_card_ripple_background">
+ <item android:id="@android:id/mask">
+ <color android:color="#ffffffff" />
+ </item>
+</ripple>
diff --git a/res/layout/ongoing_call.xml b/res/layout/ongoing_call.xml
index e6d483f3..5d8db5ac 100644
--- a/res/layout/ongoing_call.xml
+++ b/res/layout/ongoing_call.xml
@@ -149,16 +149,16 @@
android:visibility="gone" >
<ImageButton
android:id="@+id/answer_call_button"
- android:layout_width="@dimen/stream_fab_size"
- android:layout_height="@dimen/stream_fab_size"
+ android:layout_width="@dimen/dialer_fab_size"
+ android:layout_height="@dimen/dialer_fab_size"
android:layout_gravity="center_vertical"
android:scaleType="center"
android:elevation="8dp"
android:src="@drawable/ic_phone" />
<ImageButton
android:id="@+id/reject_call_button"
- android:layout_width="@dimen/stream_fab_size"
- android:layout_height="@dimen/stream_fab_size"
+ android:layout_width="@dimen/dialer_fab_size"
+ android:layout_height="@dimen/dialer_fab_size"
android:layout_marginStart="@dimen/in_call_button_spacing"
android:layout_gravity="center_vertical"
android:scaleType="center"
@@ -176,16 +176,16 @@
android:visibility="gone" >
<ImageButton
android:id="@+id/end_call"
- android:layout_width="@dimen/stream_fab_size"
- android:layout_height="@dimen/stream_fab_size"
+ android:layout_width="@dimen/dialer_fab_size"
+ android:layout_height="@dimen/dialer_fab_size"
android:layout_gravity="center_vertical"
android:scaleType="center"
android:elevation="8dp"
android:src="@drawable/ic_call_end" />
<ImageButton
android:id="@+id/unhold_call"
- android:layout_width="@dimen/stream_fab_size"
- android:layout_height="@dimen/stream_fab_size"
+ android:layout_width="@dimen/dialer_fab_size"
+ android:layout_height="@dimen/dialer_fab_size"
android:layout_gravity="center_vertical"
android:scaleType="center"
android:elevation="8dp"
@@ -193,8 +193,8 @@
android:visibility="gone" />
<ImageButton
android:id="@+id/mute"
- android:layout_width="@dimen/stream_fab_size"
- android:layout_height="@dimen/stream_fab_size"
+ android:layout_width="@dimen/dialer_fab_size"
+ android:layout_height="@dimen/dialer_fab_size"
android:layout_marginStart="@dimen/in_call_button_spacing"
android:scaleType="center"
android:src="@drawable/ic_mute"
@@ -202,8 +202,8 @@
android:background="@drawable/ongoing_call_action_background" />
<ImageButton
android:id="@+id/toggle_dialpad"
- android:layout_width="@dimen/stream_fab_size"
- android:layout_height="@dimen/stream_fab_size"
+ android:layout_width="@dimen/dialer_fab_size"
+ android:layout_height="@dimen/dialer_fab_size"
android:layout_marginStart="@dimen/in_call_button_spacing"
android:scaleType="center"
android:src="@drawable/ic_dialpad"
@@ -224,15 +224,15 @@
android:visibility="gone" >
<ImageButton
android:id="@+id/swap"
- android:layout_width="@dimen/stream_fab_size"
- android:layout_height="@dimen/stream_fab_size"
+ android:layout_width="@dimen/dialer_fab_size"
+ android:layout_height="@dimen/dialer_fab_size"
android:scaleType="center"
android:src="@drawable/ic_swap_calls"
android:background="@drawable/ongoing_call_secondary_action_background" />
<ImageButton
android:id="@+id/merge"
- android:layout_width="@dimen/stream_fab_size"
- android:layout_height="@dimen/stream_fab_size"
+ android:layout_width="@dimen/dialer_fab_size"
+ android:layout_height="@dimen/dialer_fab_size"
android:scaleType="center"
android:src="@drawable/ic_call_merge"
android:background="@drawable/ongoing_call_secondary_action_background" />
diff --git a/res/values-h480dp/dimens.xml b/res/values-h480dp/dimens.xml
new file mode 100644
index 00000000..eb97fb6b
--- /dev/null
+++ b/res/values-h480dp/dimens.xml
@@ -0,0 +1,18 @@
+<?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.
+-->
+<resources>
+ <dimen name="dialer_fab_size">100dp</dimen>
+</resources>
diff --git a/res/values-h600dp/dimens.xml b/res/values-h600dp/dimens.xml
index b129a966..8de61922 100644
--- a/res/values-h600dp/dimens.xml
+++ b/res/values-h600dp/dimens.xml
@@ -15,4 +15,6 @@
-->
<resources>
<dimen name="avatar_rounded_radius">98dp</dimen>
+ <dimen name="car_key1_size">50sp</dimen>
+ <dimen name="car_key2_size">22sp</dimen>
</resources>
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index 3a47dd08..09f85f74 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -20,4 +20,7 @@
<color name="telecom_display_scrim">#52000000</color> <!-- 32% black -->
<color name="search_container_controls_tint">@color/car_grey_100</color>
<color name="search_container_text_hint">@color/car_body2_light</color>
+ <color name="car_caption">@color/car_caption_light</color>
+ <color name="car_key1">@color/car_key1_light</color>
+ <color name="car_key2">@color/car_key2_light</color>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 61b1ddd0..560bf993 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -43,4 +43,17 @@
<!-- The color of the hint text in the search field. -->
<color name="search_container_text_hint">@color/car_grey_400</color>
+
+ <!-- TextAppearances -->
+ <color name="car_caption_light">@color/car_grey_400</color>
+ <color name="car_caption_dark">@color/car_grey_700</color>
+ <color name="car_caption">@color/car_caption_dark</color>
+
+ <color name="car_key1_light">@color/car_grey_100</color>
+ <color name="car_key1_dark">@color/car_light_blue_700</color>
+ <color name="car_key1">@color/car_key1_dark</color>
+
+ <color name="car_key2_light">@color/car_grey_400</color>
+ <color name="car_key2_dark">@color/car_grey_650</color>
+ <color name="car_key2">@color/car_key2_dark</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index b3bfd947..70196fec 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -92,6 +92,7 @@
<dimen name="dialer_number_view_height">128dp</dimen>
<dimen name="dialer_number_view_padding">32dp</dimen>
+ <dimen name="dialer_fab_size">80dp</dimen>
<dimen name="call_fab_elevation">8dp</dimen>
<dimen name="bksp_button_width">@dimen/car_touch_target_size</dimen>
<!-- Fab button size is touch target (76dp) + stroke width (8dp) * 2-->
@@ -102,4 +103,6 @@
<dimen name="user_profile_title_margin_top">@dimen/car_padding_3</dimen>
<dimen name="user_profile_body_margin_top">@dimen/car_padding_3</dimen>
+ <dimen name="car_key1_size">40sp</dimen>
+ <dimen name="car_key2_size">18sp</dimen>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index ae409390..ab9e5967 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -14,6 +14,17 @@
limitations under the License.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <style name="TextAppearance.Car.Key1" >
+ <item name="android:textStyle">normal</item>
+ <item name="android:textSize">@dimen/car_key1_size</item>
+ <item name="android:textColor">@color/car_key1</item>
+ </style>
+
+ <style name="TextAppearance.Car.Key2" >
+ <item name="android:textStyle">normal</item>
+ <item name="android:textSize">@dimen/car_key2_size</item>
+ <item name="android:textColor">@color/car_key2</item>
+ </style>
<!-- Phone -->
<style name="DialpadKeyButtonStyle">
diff --git a/src/com/android/car/dialer/ContactResultViewHolder.java b/src/com/android/car/dialer/ContactResultViewHolder.java
index 6197ec5e..2a739441 100644
--- a/src/com/android/car/dialer/ContactResultViewHolder.java
+++ b/src/com/android/car/dialer/ContactResultViewHolder.java
@@ -27,8 +27,8 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
-import com.android.car.apps.common.CircleBitmapDrawable;
import com.android.car.apps.common.LetterTileDrawable;
+import com.android.car.dialer.ui.CircleBitmapDrawable;
import com.android.car.view.CardListBackgroundResolver;
import java.io.FileNotFoundException;
diff --git a/src/com/android/car/dialer/OngoingCallFragment.java b/src/com/android/car/dialer/OngoingCallFragment.java
index 2f702448..1c6445a7 100644
--- a/src/com/android/car/dialer/OngoingCallFragment.java
+++ b/src/com/android/car/dialer/OngoingCallFragment.java
@@ -40,11 +40,11 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
-import com.android.car.apps.common.CircleBitmapDrawable;
import com.android.car.apps.common.FabDrawable;
import com.android.car.dialer.telecom.TelecomUtils;
import com.android.car.dialer.telecom.UiCall;
import com.android.car.dialer.telecom.UiCallManager;
+import com.android.car.dialer.ui.CircleBitmapDrawable;
import java.util.Arrays;
import java.util.List;
diff --git a/src/com/android/car/dialer/telecom/TelecomUtils.java b/src/com/android/car/dialer/telecom/TelecomUtils.java
index 78335b70..a0bd4d81 100644
--- a/src/com/android/car/dialer/telecom/TelecomUtils.java
+++ b/src/com/android/car/dialer/telecom/TelecomUtils.java
@@ -39,9 +39,9 @@ import android.text.format.DateUtils;
import android.util.Log;
import android.widget.ImageView;
-import com.android.car.apps.common.CircleBitmapDrawable;
import com.android.car.apps.common.LetterTileDrawable;
import com.android.car.dialer.R;
+import com.android.car.dialer.ui.CircleBitmapDrawable;
import java.io.InputStream;
import java.util.Locale;
diff --git a/src/com/android/car/dialer/ui/CircleBitmapDrawable.java b/src/com/android/car/dialer/ui/CircleBitmapDrawable.java
new file mode 100644
index 00000000..1d357267
--- /dev/null
+++ b/src/com/android/car/dialer/ui/CircleBitmapDrawable.java
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+package com.android.car.dialer.ui;
+
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.PixelFormat;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.support.annotation.NonNull;
+import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
+import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
+
+
+/**
+ * A drawable for displaying a circular bitmap. This is a wrapper over {@link RoundedBitmapDrawable}
+ * since that implementation doesn't behave quite as desired.
+ *
+ * <p>Note that not all drawable functionality is passed to the RoundedBitmapDrawable at this
+ * time. Feel free to add more as necessary.
+ */
+public class CircleBitmapDrawable extends Drawable {
+ private final Resources mResources;
+
+ private Bitmap mBitmap;
+ private RoundedBitmapDrawable mDrawable;
+ private int mAlpha = -1;
+ private ColorFilter mCf = null;
+
+ public CircleBitmapDrawable(@NonNull Resources res, @NonNull Bitmap bitmap) {
+ mBitmap = bitmap;
+ mResources = res;
+ }
+
+ @Override
+ public void onBoundsChange(Rect bounds) {
+ super.onBoundsChange(bounds);
+ int width = bounds.right - bounds.left;
+ int height = bounds.bottom - bounds.top;
+
+ Bitmap processed = mBitmap;
+ mDrawable = RoundedBitmapDrawableFactory.create(mResources, processed);
+ mDrawable.setBounds(bounds);
+ mDrawable.setAntiAlias(true);
+ mDrawable.setCornerRadius(Math.min(width, height) / 2f);
+ if (mAlpha != -1) {
+ mDrawable.setAlpha(mAlpha);
+ }
+ if (mCf != null) {
+ mDrawable.setColorFilter(mCf);
+ }
+ invalidateSelf();
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ if (mDrawable != null) {
+ mDrawable.draw(canvas);
+ }
+ }
+
+ @Override
+ public int getOpacity() {
+ return mDrawable != null ? mDrawable.getOpacity() : PixelFormat.TRANSLUCENT;
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+ mAlpha = alpha;
+ if (mDrawable != null) {
+ mDrawable.setAlpha(alpha);
+ invalidateSelf();
+ }
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter cf) {
+ mCf = cf;
+ if (mDrawable != null) {
+ mDrawable.setColorFilter(cf);
+ invalidateSelf();
+ }
+ }
+
+ /**
+ * Convert the drawable to a bitmap.
+ * @param size The target size of the bitmap in pixels.
+ * @return A bitmap representation of the drawable.
+ */
+ public Bitmap toBitmap(int size) {
+ Bitmap largeIcon = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(largeIcon);
+ Rect bounds = getBounds();
+ setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
+ draw(canvas);
+ setBounds(bounds);
+ return largeIcon;
+ }
+}
+
diff --git a/src/com/android/car/dialer/ui/InCallFragment.java b/src/com/android/car/dialer/ui/InCallFragment.java
index 16854691..d43c8c9b 100644
--- a/src/com/android/car/dialer/ui/InCallFragment.java
+++ b/src/com/android/car/dialer/ui/InCallFragment.java
@@ -20,18 +20,15 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
-import android.telecom.Call;
-import android.text.format.DateUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
-import com.android.car.apps.common.CircleBitmapDrawable;
import com.android.car.dialer.BitmapWorkerTask;
-import com.android.car.dialer.R;
import com.android.car.dialer.DialerFragment;
+import com.android.car.dialer.R;
import com.android.car.dialer.telecom.TelecomUtils;
import com.android.car.dialer.telecom.UiCall;
import com.android.car.dialer.telecom.UiCallManager;
diff --git a/src/com/android/car/dialer/ui/listitem/CallLogListItem.java b/src/com/android/car/dialer/ui/listitem/CallLogListItem.java
index 48240c8f..56aff1b3 100644
--- a/src/com/android/car/dialer/ui/listitem/CallLogListItem.java
+++ b/src/com/android/car/dialer/ui/listitem/CallLogListItem.java
@@ -20,11 +20,11 @@ import android.content.res.Resources;
import androidx.car.widget.TextListItem;
-import com.android.car.apps.common.CircleBitmapDrawable;
import com.android.car.apps.common.LetterTileDrawable;
import com.android.car.dialer.telecom.ContactBitmapWorker;
import com.android.car.dialer.ui.CallHistoryListItemProvider;
import com.android.car.dialer.ui.CallLogListingTask;
+import com.android.car.dialer.ui.CircleBitmapDrawable;
/**
* List item which is created by {@link CallHistoryListItemProvider} binds a call list item to a
diff --git a/src/com/android/car/dialer/ui/listitem/ContactListItem.java b/src/com/android/car/dialer/ui/listitem/ContactListItem.java
index a076013b..58971d40 100644
--- a/src/com/android/car/dialer/ui/listitem/ContactListItem.java
+++ b/src/com/android/car/dialer/ui/listitem/ContactListItem.java
@@ -20,9 +20,9 @@ import android.content.res.Resources;
import androidx.car.widget.TextListItem;
-import com.android.car.apps.common.CircleBitmapDrawable;
import com.android.car.apps.common.LetterTileDrawable;
import com.android.car.dialer.telecom.ContactBitmapWorker;
+import com.android.car.dialer.ui.CircleBitmapDrawable;
import com.android.car.dialer.ui.ContactListFragment;
/**