summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-03-29 18:45:04 +0000
committerandroid-build-merger <android-build-merger@google.com>2018-03-29 18:45:04 +0000
commite54d4d1557e56d23819351260ec46d0d26665bcc (patch)
tree3f069e9df345e44ecef8b48f939a52f51393bb9a
parentbd198df6107e86d92c7d71792abca5c2437056e2 (diff)
parent82c8be24c1db17a6c504b89f801f8ad1bbed7aae (diff)
Merge "Badge contact photos for video calls in the bottom sheet."
am: 82c8be24c1 Change-Id: Icec36ec3b5675b1115c3c380d75a1ca33e5e41d1
-rw-r--r--java/com/android/dialer/calllog/ui/NewCallLogAdapter.java7
-rw-r--r--java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java13
-rw-r--r--java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java9
-rw-r--r--java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java25
-rw-r--r--java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml15
-rw-r--r--java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java3
-rw-r--r--java/com/android/dialer/voicemail/listui/menu/NewVoicemailMenu.java6
-rw-r--r--java/com/android/dialer/widget/res/layout/contact_photo_view.xml1
8 files changed, 25 insertions, 54 deletions
diff --git a/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java b/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java
index f7ba9efde..05a339978 100644
--- a/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java
+++ b/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java
@@ -25,8 +25,6 @@ import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.android.dialer.calllogutils.CallLogDates;
import com.android.dialer.common.Assert;
-import com.android.dialer.glidephotomanager.GlidePhotoManager;
-import com.android.dialer.glidephotomanager.GlidePhotoManagerComponent;
import com.android.dialer.time.Clock;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -55,7 +53,6 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> {
private final Clock clock;
private final RealtimeRowProcessor realtimeRowProcessor;
- private final GlidePhotoManager glidePhotoManager;
private Cursor cursor;
@@ -72,7 +69,6 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> {
this.cursor = cursor;
this.clock = clock;
this.realtimeRowProcessor = CallLogUiComponent.get(context).realtimeRowProcessor();
- this.glidePhotoManager = GlidePhotoManagerComponent.get(context).glidePhotoManager();
setHeaderPositions();
}
@@ -142,8 +138,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter<ViewHolder> {
LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.new_call_log_entry, viewGroup, false),
clock,
- realtimeRowProcessor,
- glidePhotoManager);
+ realtimeRowProcessor);
default:
throw Assert.createUnsupportedOperationFailException("Unsupported view type: " + viewType);
}
diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
index 9809d97f5..f322b562b 100644
--- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
+++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java
@@ -34,7 +34,6 @@ import com.android.dialer.calllogutils.NumberAttributesConverter;
import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.compat.AppCompatConstants;
import com.android.dialer.compat.telephony.TelephonyManagerCompat;
-import com.android.dialer.glidephotomanager.GlidePhotoManager;
import com.android.dialer.oem.MotorolaUtils;
import com.android.dialer.time.Clock;
import com.android.dialer.widget.ContactPhotoView;
@@ -62,15 +61,9 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
private final RealtimeRowProcessor realtimeRowProcessor;
private final ExecutorService uiExecutorService;
- private final GlidePhotoManager glidePhotoManager;
-
private long currentRowId;
- NewCallLogViewHolder(
- View view,
- Clock clock,
- RealtimeRowProcessor realtimeRowProcessor,
- GlidePhotoManager glidePhotoManager) {
+ NewCallLogViewHolder(View view, Clock clock, RealtimeRowProcessor realtimeRowProcessor) {
super(view);
this.context = view.getContext();
contactPhotoView = view.findViewById(R.id.contact_photo_view);
@@ -86,7 +79,6 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
this.clock = clock;
this.realtimeRowProcessor = realtimeRowProcessor;
- this.glidePhotoManager = glidePhotoManager;
uiExecutorService = DialerExecutorComponent.get(context).uiExecutor();
}
@@ -251,8 +243,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder {
}
private void setOnClickListenerForMenuButon(CoalescedRow row) {
- menuButton.setOnClickListener(
- NewCallLogMenu.createOnClickListener(context, row, glidePhotoManager));
+ menuButton.setOnClickListener(NewCallLogMenu.createOnClickListener(context, row));
}
private class RealtimeRowFutureCallback implements FutureCallback<CoalescedRow> {
diff --git a/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java b/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java
index 78354caac..dabb9bbe4 100644
--- a/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java
+++ b/java/com/android/dialer/calllog/ui/menu/NewCallLogMenu.java
@@ -22,7 +22,6 @@ import android.view.View;
import com.android.dialer.calllog.CallLogComponent;
import com.android.dialer.calllog.model.CoalescedRow;
import com.android.dialer.common.concurrent.DefaultFutureCallback;
-import com.android.dialer.glidephotomanager.GlidePhotoManager;
import com.android.dialer.historyitemactions.HistoryItemActionBottomSheet;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
@@ -31,14 +30,10 @@ import com.google.common.util.concurrent.MoreExecutors;
public final class NewCallLogMenu {
/** Creates and returns the OnClickListener which opens the menu for the provided row. */
- public static View.OnClickListener createOnClickListener(
- Context context, CoalescedRow row, GlidePhotoManager glidePhotoManager) {
+ public static View.OnClickListener createOnClickListener(Context context, CoalescedRow row) {
return view -> {
HistoryItemActionBottomSheet.show(
- context,
- BottomSheetHeader.fromRow(context, row),
- Modules.fromRow(context, row),
- glidePhotoManager);
+ context, BottomSheetHeader.fromRow(context, row), Modules.fromRow(context, row));
// If the user opens the bottom sheet for a new call, clear the notifications and make the row
// not bold immediately. To do this, mark all of the calls in group as not new.
diff --git a/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java b/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java
index ce303272c..79205a7d9 100644
--- a/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java
+++ b/java/com/android/dialer/historyitemactions/HistoryItemActionBottomSheet.java
@@ -28,42 +28,37 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.dialer.common.Assert;
-import com.android.dialer.glidephotomanager.GlidePhotoManager;
+import com.android.dialer.widget.ContactPhotoView;
import java.util.List;
/**
* {@link BottomSheetDialog} used to show a list of actions in a bottom sheet menu.
*
- * <p>{@link #show(Context, HistoryItemBottomSheetHeaderInfo, List, GlidePhotoManager)} should be
- * used to create and display the menu. Modules are built using {@link HistoryItemActionModule} and
- * some defaults are provided by {@link IntentModule} and {@link DividerModule}.
+ * <p>{@link #show(Context, HistoryItemBottomSheetHeaderInfo, List)} should be used to create and
+ * display the menu. Modules are built using {@link HistoryItemActionModule} and some defaults are
+ * provided by {@link IntentModule} and {@link DividerModule}.
*/
public class HistoryItemActionBottomSheet extends BottomSheetDialog implements OnClickListener {
private final List<HistoryItemActionModule> modules;
private final HistoryItemBottomSheetHeaderInfo historyItemBottomSheetHeaderInfo;
- private final GlidePhotoManager glidePhotoManager;
private HistoryItemActionBottomSheet(
Context context,
HistoryItemBottomSheetHeaderInfo historyItemBottomSheetHeaderInfo,
- List<HistoryItemActionModule> modules,
- GlidePhotoManager glidePhotoManager) {
+ List<HistoryItemActionModule> modules) {
super(context);
this.modules = modules;
this.historyItemBottomSheetHeaderInfo = historyItemBottomSheetHeaderInfo;
- this.glidePhotoManager = glidePhotoManager;
setContentView(LayoutInflater.from(context).inflate(R.layout.sheet_layout, null));
}
public static HistoryItemActionBottomSheet show(
Context context,
HistoryItemBottomSheetHeaderInfo historyItemBottomSheetHeaderInfo,
- List<HistoryItemActionModule> modules,
- GlidePhotoManager glidePhotoManager) {
+ List<HistoryItemActionModule> modules) {
HistoryItemActionBottomSheet sheet =
- new HistoryItemActionBottomSheet(
- context, historyItemBottomSheetHeaderInfo, modules, glidePhotoManager);
+ new HistoryItemActionBottomSheet(context, historyItemBottomSheetHeaderInfo, modules);
sheet.show();
return sheet;
}
@@ -87,10 +82,8 @@ public class HistoryItemActionBottomSheet extends BottomSheetDialog implements O
LayoutInflater inflater = LayoutInflater.from(getContext());
View contactView = inflater.inflate(R.layout.contact_layout, container, false);
- // TODO(zachh): The contact image should be badged with a video icon if it is for a video call.
- glidePhotoManager.loadQuickContactBadge(
- contactView.findViewById(R.id.quick_contact_photo),
- historyItemBottomSheetHeaderInfo.getPhotoInfo());
+ ContactPhotoView contactPhotoView = contactView.findViewById(R.id.contact_photo_view);
+ contactPhotoView.setPhoto(historyItemBottomSheetHeaderInfo.getPhotoInfo());
TextView primaryTextView = contactView.findViewById(R.id.primary_text);
TextView secondaryTextView = contactView.findViewById(R.id.secondary_text);
diff --git a/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml b/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml
index 4deef3e07..f2dc8c7ac 100644
--- a/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml
+++ b/java/com/android/dialer/historyitemactions/res/layout/contact_layout.xml
@@ -23,14 +23,13 @@
android:gravity="center_vertical"
android:orientation="horizontal">
- <QuickContactBadge
- android:id="@+id/quick_contact_photo"
- android:layout_width="@dimen/contact_actions_image_size"
- android:layout_height="@dimen/contact_actions_image_size"
- android:layout_marginStart="@dimen/contact_actions_image_margin"
- android:layout_marginEnd="@dimen/contact_actions_image_margin"
- android:padding="4dp"
- android:focusable="true"/>
+ <com.android.dialer.widget.ContactPhotoView
+ android:id="@+id/contact_photo_view"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="10dp"
+ android:layout_marginEnd="10dp"
+ android:minHeight="@dimen/contact_actions_image_size"/>
<LinearLayout
android:layout_width="wrap_content"
diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java
index d42c255eb..66e2195b7 100644
--- a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java
+++ b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java
@@ -151,8 +151,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On
itemView.setOnClickListener(this);
menuButton.setOnClickListener(
- NewVoicemailMenu.createOnClickListener(
- context, voicemailEntryOfViewHolder, glidePhotoManager));
+ NewVoicemailMenu.createOnClickListener(context, voicemailEntryOfViewHolder));
setPhoto(voicemailEntryOfViewHolder);
diff --git a/java/com/android/dialer/voicemail/listui/menu/NewVoicemailMenu.java b/java/com/android/dialer/voicemail/listui/menu/NewVoicemailMenu.java
index 7ec86c5b9..60080598d 100644
--- a/java/com/android/dialer/voicemail/listui/menu/NewVoicemailMenu.java
+++ b/java/com/android/dialer/voicemail/listui/menu/NewVoicemailMenu.java
@@ -18,7 +18,6 @@ package com.android.dialer.voicemail.listui.menu;
import android.content.Context;
import android.view.View;
-import com.android.dialer.glidephotomanager.GlidePhotoManager;
import com.android.dialer.historyitemactions.HistoryItemActionBottomSheet;
import com.android.dialer.voicemail.model.VoicemailEntry;
@@ -27,12 +26,11 @@ public final class NewVoicemailMenu {
/** Creates and returns the OnClickListener which opens the menu for the provided row. */
public static View.OnClickListener createOnClickListener(
- Context context, VoicemailEntry voicemailEntry, GlidePhotoManager glidePhotoManager) {
+ Context context, VoicemailEntry voicemailEntry) {
return (view) ->
HistoryItemActionBottomSheet.show(
context,
BottomSheetHeader.fromVoicemailEntry(voicemailEntry),
- Modules.fromVoicemailEntry(context, voicemailEntry),
- glidePhotoManager);
+ Modules.fromVoicemailEntry(context, voicemailEntry));
}
}
diff --git a/java/com/android/dialer/widget/res/layout/contact_photo_view.xml b/java/com/android/dialer/widget/res/layout/contact_photo_view.xml
index e505e5866..2f5cd9e3d 100644
--- a/java/com/android/dialer/widget/res/layout/contact_photo_view.xml
+++ b/java/com/android/dialer/widget/res/layout/contact_photo_view.xml
@@ -19,6 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="52dp"
android:layout_height="44dp"
+ android:layout_gravity="center"
android:focusable="false">
<QuickContactBadge