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

Commit 9ec8a75d authored by Daniel Lehmann's avatar Daniel Lehmann Committed by Android (Google) Code Review
Browse files

Merge "Don't show triangle and on-press state if there is no action" into jb-dev

parents 7fdff306 74055220
Loading
Loading
Loading
Loading
+31 −18
Original line number Diff line number Diff line
@@ -17,6 +17,11 @@
<view
    class="com.android.contacts.editor.PhotoEditorView"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    >
    <FrameLayout
        android:layout_width="48dip"
        android:layout_height="48dip"
    >
@@ -38,4 +43,12 @@
            android:contentDescription="@string/description_contact_photo"
            android:background="?android:attr/selectableItemBackground"
        />
    </FrameLayout>
    <ImageView
        android:id="@+id/photo_triangle_affordance"
        android:src="@drawable/account_spinner_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
    />
</view>
+3 −17
Original line number Diff line number Diff line
@@ -52,25 +52,11 @@

            </LinearLayout>

            <LinearLayout
                android:id="@+id/stub_photo"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="8dip"
                android:orientation="horizontal">

            <include
                android:id="@+id/edit_photo"
                android:layout_marginRight="8dip"
                layout="@layout/item_photo_editor" />

                <ImageView
                    android:src="@drawable/account_spinner_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom" />

            </LinearLayout>

        </LinearLayout>

        <LinearLayout
+3 −17
Original line number Diff line number Diff line
@@ -42,25 +42,11 @@
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="?android:attr/textColorSecondary" />

        <LinearLayout
            android:id="@+id/stub_photo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="8dip"
            android:orientation="horizontal">

        <include
            android:id="@+id/edit_photo"
            android:layout_marginRight="8dip"
            layout="@layout/item_photo_editor" />

            <ImageView
                android:src="@drawable/account_spinner_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom" />

        </LinearLayout>

    </LinearLayout>

    <Button
+2 −1
Original line number Diff line number Diff line
@@ -799,6 +799,7 @@ public class ContactEditorFragment extends Fragment implements
                mode = PhotoActionPopup.Modes.READ_ONLY_ALLOW_PRIMARY;
            } else {
                // Read-only and either no photo or the only photo ==> no options
                editor.getPhotoEditor().setEditorListener(null);
                return;
            }
        }
@@ -882,7 +883,7 @@ public class ContactEditorFragment extends Fragment implements
        // Remove the pressed state from the account header because the user cannot switch accounts
        // on an existing contact
        final View accountView = editor.findViewById(R.id.account);
        accountView.setBackgroundDrawable(null);
        accountView.setBackground(null);
        accountView.setEnabled(false);
    }

+9 −5
Original line number Diff line number Diff line
@@ -16,12 +16,12 @@

package com.android.contacts.editor;

import com.android.contacts.ContactsUtils;
import com.android.contacts.R;
import com.android.contacts.model.DataKind;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.util.ContactPhotoUtils;
import com.android.contacts.ContactsUtils;

import android.content.Context;
import android.graphics.Bitmap;
@@ -29,19 +29,20 @@ import android.graphics.BitmapFactory;
import android.provider.ContactsContract.CommonDataKinds.Photo;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

/**
 * Simple editor for {@link Photo}.
 */
public class PhotoEditorView extends FrameLayout implements Editor {
public class PhotoEditorView extends LinearLayout implements Editor {

    private ImageView mPhotoImageView;
    private View mFrameView;

    private ValuesDelta mEntry;
    private EditorListener mListener;
    private View mTriangleAffordance;

    private boolean mHasSetPhoto = false;
    private boolean mReadOnly;
@@ -70,6 +71,7 @@ public class PhotoEditorView extends FrameLayout implements Editor {
    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mTriangleAffordance = findViewById(R.id.photo_triangle_affordance);
        mPhotoImageView = (ImageView) findViewById(R.id.photo);
        mFrameView = findViewById(R.id.frame);
        mFrameView.setOnClickListener(new OnClickListener() {
@@ -123,8 +125,6 @@ public class PhotoEditorView extends FrameLayout implements Editor {
        return mHasSetPhoto;
    }



    /**
     * Assign the given {@link Bitmap} as the new value, updating UI and
     * readying for persisting through {@link ValuesDelta}.
@@ -176,6 +176,10 @@ public class PhotoEditorView extends FrameLayout implements Editor {
    @Override
    public void setEditorListener(EditorListener listener) {
        mListener = listener;

        final boolean isPushable = listener != null;
        mTriangleAffordance.setVisibility(isPushable ? View.VISIBLE : View.INVISIBLE);
        mFrameView.setVisibility(isPushable ? View.VISIBLE : View.INVISIBLE);
    }

    @Override
Loading