Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7846f2e0 authored by Yorke Lee's avatar Yorke Lee
Browse files

Hide shadow overlay for contact tiles with letter tile avatars

Also tweak layout of letter tiles to better match redlines

Bug: 13101785
Change-Id: I1846947a389bbdccc30bfe388b24e80e8724a357
parent 56cb0efa
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -24,11 +24,8 @@ import android.content.ClipData;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;

import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.MoreContactUtils;
@@ -51,11 +48,11 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
    private static final String TAG = PhoneFavoriteTileView.class.getSimpleName();
    private static final boolean DEBUG = false;

    // These parameters instruct the photo manager to display the default image/letter at 80% of
    // These parameters instruct the photo manager to display the default image/letter at 70% of
    // its normal size, and vertically offset upwards 20% towards the top of the letter tile, to
    // make room for the contact name and number label at the bottom of the image.
    private static final float DEFAULT_IMAGE_LETTER_OFFSET = -0.2f;
    private static final float DEFAULT_IMAGE_LETTER_SCALE = 0.8f;
    private static final float DEFAULT_IMAGE_LETTER_SCALE = 0.70f;

    /** Length of all animations in miniseconds. */
    private int mAnimationDuration;
@@ -68,6 +65,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
    private View mUndoRemovalButton;
    /** The view that holds the list view row. */
    protected ContactTileRow mParentRow;
    /** View that contains the transparent shadow that is overlaid on top of the contact image. */
    private View mShadowOverlay;

    /** Users' most frequent phone number. */
    private String mPhoneNumberString;
@@ -91,10 +90,10 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mFavoriteContactCard = findViewById(com.android.dialer.R.id.contact_favorite_card);
        mRemovalDialogue = findViewById(com.android.dialer.R.id.favorite_remove_dialogue);
        mUndoRemovalButton = findViewById(com.android.dialer.R.id
                .favorite_remove_undo_button);
        mShadowOverlay = findViewById(R.id.shadow_overlay);
        mFavoriteContactCard = findViewById(R.id.contact_favorite_card);
        mRemovalDialogue = findViewById(R.id.favorite_remove_dialogue);
        mUndoRemovalButton = findViewById(R.id.favorite_remove_undo_button);

        mUndoRemovalButton.setOnClickListener(new OnClickListener() {
            @Override
@@ -250,4 +249,12 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
        return new DefaultImageRequest(displayName, lookupKey, ContactPhotoManager.TYPE_DEFAULT,
                DEFAULT_IMAGE_LETTER_SCALE, DEFAULT_IMAGE_LETTER_OFFSET);
    }

    @Override
    protected void configureViewForImage(boolean isDefaultImage) {
        // Hide the shadow overlay if the image is a default image (i.e. colored letter tile)
        if (mShadowOverlay != null) {
            mShadowOverlay.setVisibility(isDefaultImage ? View.GONE : View.VISIBLE);
        }
    }
}