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

Commit afe795a2 authored by Josh Gargus's avatar Josh Gargus Committed by Android (Google) Code Review
Browse files

Merge "Add press-states to ContactDetailFragment." into jb-dev

parents 5e50b6dc fc81892e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -32,6 +32,13 @@
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"/>

        <View android:id="@+id/photo_overlay"
            android:background="?android:attr/selectableItemBackground"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"/>

        <!-- Transparent view to overlay on the contact's photo
        (to allow white text to appear over a white photo). -->
        <View android:id="@+id/label_background"
+4 −2
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ public class ContactDetailTabCarousel extends HorizontalScrollView implements On
    private int mTabShadowHeight;

    private ImageView mPhotoView;
    private View mPhotoViewOverlay;
    private TextView mStatusView;
    private ImageView mStatusPhotoView;
    private final ContactDetailPhotoSetter mPhotoSetter = new ContactDetailPhotoSetter();
@@ -136,6 +137,7 @@ public class ContactDetailTabCarousel extends HorizontalScrollView implements On
        // Retrieve the photo view for the "about" tab
        // TODO: This should be moved down to mAboutTab, so that it hosts its own controls
        mPhotoView = (ImageView) mAboutTab.findViewById(R.id.photo);
        mPhotoViewOverlay = mAboutTab.findViewById(R.id.photo_overlay);

        // Retrieve the social update views for the "updates" tab
        // TODO: This should be moved down to mUpdatesTab, so that it hosts its own controls
@@ -466,11 +468,11 @@ public class ContactDetailTabCarousel extends HorizontalScrollView implements On
                mContext, contactData, mPhotoView, expandOnClick);

        if (expandOnClick || contactData.isWritableContact(mContext)) {
            mPhotoView.setOnClickListener(listener);
            mPhotoViewOverlay.setOnClickListener(listener);
        } else {
            // Work around framework issue... if we instead use
            // setClickable(false), then we can't swipe horizontally.
            mPhotoView.setOnClickListener(null);
            mPhotoViewOverlay.setOnClickListener(null);
        }

        ContactDetailDisplayUtils.setSocialSnippet(
+27 −7
Original line number Diff line number Diff line
@@ -17,9 +17,11 @@
package com.android.contacts.widget;

import com.android.contacts.detail.ContactDetailDisplayUtils;
import com.android.contacts.util.ThemeUtils;

import android.content.Context;
import android.view.View;
import android.widget.FrameLayout;

/**
 * A View that other Views can use to create a touch-interceptor layer above
@@ -37,16 +39,21 @@ import android.view.View;
 * Typically, you would not use this class directly, but rather use another class
 * that uses it, for example {@link FrameLayoutWithOverlay}.
 */
public class AlphaTouchInterceptorOverlay extends View {
public class AlphaTouchInterceptorOverlay extends FrameLayout {

    private View mAlphaLayer = this;
    private float mAlpha = 1.0f;
    private View mInterceptorLayer;
    private View mAlphaLayer;
    private float mAlpha = 0.0f;

    public AlphaTouchInterceptorOverlay(Context context) {
        super(context);
        setAlphaLayer(this);
        setVisibility(VISIBLE);
        ContactDetailDisplayUtils.setAlphaOnViewBackground(this, 1.0f);

        mInterceptorLayer = new View(context);
        final int resId = ThemeUtils.getSelectableItemBackground(context.getTheme());
        mInterceptorLayer.setBackgroundResource(resId);
        addView(mInterceptorLayer);

        mAlphaLayer = this;
    }

    /**
@@ -60,6 +67,7 @@ public class AlphaTouchInterceptorOverlay extends View {

        // We're no longer the alpha-layer, so make ourself invisible.
        if (mAlphaLayer == this) ContactDetailDisplayUtils.setAlphaOnViewBackground(this, 0.0f);

        mAlphaLayer = (alphaLayer == null) ? this : alphaLayer;
        setAlphaLayerValue(mAlpha);
    }
@@ -67,6 +75,18 @@ public class AlphaTouchInterceptorOverlay extends View {
    /** Sets the alpha value on the alpha layer. */
    public void setAlphaLayerValue(float alpha) {
        mAlpha = alpha;
        if (mAlphaLayer != null) {
            ContactDetailDisplayUtils.setAlphaOnViewBackground(mAlphaLayer, mAlpha);
        }
    }

    /** Delegate to interceptor-layer. */
    public void setOverlayOnClickListener(OnClickListener listener) {
        mInterceptorLayer.setOnClickListener(listener);
    }

    /** Delegate to interceptor-layer. */
    public void setOverlayClickable(boolean clickable) {
        mInterceptorLayer.setClickable(clickable);
    }
}
+4 −5
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;


/**
 * A FrameLayout whose contents are kept beneath an {@link AlphaTouchInterceptorOverlay}.
 * If necessary, you can specify your own alpha-layer and manually manage its z-order.
@@ -47,8 +46,8 @@ public class FrameLayoutWithOverlay extends FrameLayout {
    }

    /**
     * Delegate to overlay:  set the View that it will use as it's alpha-layer.
     * If none is set, the overlay will use itself as the alpha layer.  Only
     * Delegate to overlay:  set the View that it will use as its alpha-layer.
     * If none is set, the overlay will use its own alpha layer.  Only
     * necessary to set this if some child views need to appear above the
     * alpha-layer.
     */
@@ -63,11 +62,11 @@ public class FrameLayoutWithOverlay extends FrameLayout {

    /** Delegate to overlay. */
    public void setOverlayOnClickListener(OnClickListener listener) {
        mOverlay.setOnClickListener(listener);
        mOverlay.setOverlayOnClickListener(listener);
    }

    /** Delegate to overlay. */
    public void setOverlayClickable(boolean clickable) {
        mOverlay.setClickable(clickable);
        mOverlay.setOverlayClickable(clickable);
    }
}