Add gradient behind photo icon is contact photo is set
Bug 19732687
Change-Id: Iad82b23aedf25e3e9a9ced8d2cd30190b69240de
diff --git a/res/layout/compact_photo_editor_view.xml b/res/layout/compact_photo_editor_view.xml
index f3e7f7b..33449a8 100644
--- a/res/layout/compact_photo_editor_view.xml
+++ b/res/layout/compact_photo_editor_view.xml
@@ -28,6 +28,12 @@
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
+ <View
+ android:id="@+id/photo_icon_overlay"
+ android:layout_height="56dp"
+ android:layout_width="match_parent"
+ android:layout_alignParentBottom="true" />
+
<ImageView
android:id="@+id/photo_icon"
android:layout_width="24dp"
diff --git a/src/com/android/contacts/editor/CompactPhotoEditorView.java b/src/com/android/contacts/editor/CompactPhotoEditorView.java
index ef96854..7483af6 100644
--- a/src/com/android/contacts/editor/CompactPhotoEditorView.java
+++ b/src/com/android/contacts/editor/CompactPhotoEditorView.java
@@ -34,6 +34,7 @@
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Photo;
@@ -66,6 +67,7 @@
private MaterialPalette mMaterialPalette;
private QuickContactImageView mPhotoImageView;
+ private View mPhotoIconOverlay;
public CompactPhotoEditorView(Context context) {
this(context, null);
@@ -90,6 +92,7 @@
mContactPhotoManager = ContactPhotoManager.getInstance(getContext());
mPhotoImageView = (QuickContactImageView) findViewById(R.id.photo);
+ mPhotoIconOverlay = findViewById(R.id.photo_icon_overlay);
findViewById(R.id.photo_touch_intercept_overlay).setOnClickListener(this);
}
@@ -132,7 +135,12 @@
}
}
- if (!mIsPhotoSet) {
+ if (mIsPhotoSet) {
+ // Add background color behind the white photo icon so that it's visible even
+ // if the contact photo is white.
+ mPhotoIconOverlay.setBackground(new GradientDrawable(
+ GradientDrawable.Orientation.TOP_BOTTOM, new int[]{0, 0x88000000}));
+ } else {
setDefaultPhotoTint();
}