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

Commit 88df7126 authored by Yorke Lee's avatar Yorke Lee
Browse files

Make clicking on profile image on unknown QC add a contact

Bug: 10693314
Change-Id: Ibbb7f9ae8abf91120b7e9501b4b4340bd4186e4c
parent 96421188
Loading
Loading
Loading
Loading
+21 −6
Original line number Diff line number Diff line
@@ -387,15 +387,12 @@ public class QuickContactActivity extends Activity {
            // If directory export support is not allowed, then don't allow the user to add
            // to contacts
            if (mContactData.getDirectoryExportSupport() == Directory.EXPORT_SUPPORT_NONE) {
                mOpenDetailsOrAddContactImage.setImageResource(R.drawable.ic_contacts_holo_dark);
                mOpenDetailsOrAddContactImage.setOnClickListener(mOpenDetailsClickHandler);
                configureHeaderClickActions(false);
            } else {
                mOpenDetailsOrAddContactImage.setImageResource(R.drawable.ic_add_contact_holo_dark);
                mOpenDetailsOrAddContactImage.setOnClickListener(mAddToContactsClickHandler);
                configureHeaderClickActions(true);
            }
        } else {
            mOpenDetailsOrAddContactImage.setImageResource(R.drawable.ic_contacts_holo_dark);
            mOpenDetailsOrAddContactImage.setOnClickListener(mOpenDetailsClickHandler);
            configureHeaderClickActions(false);
            mStarImage.setVisibility(View.VISIBLE);
            mStarImage.setOnClickListener(new OnClickListener() {
                @Override
@@ -544,6 +541,24 @@ public class QuickContactActivity extends Activity {
        return false;
    }

    /**
     * Bind the correct image resource and click handlers to the header views
     *
     * @param canAdd Whether or not the user can directly add information in this quick contact
     * to their local contacts
     */
    private void configureHeaderClickActions(boolean canAdd) {
        if (canAdd) {
            mOpenDetailsOrAddContactImage.setImageResource(R.drawable.ic_add_contact_holo_dark);
            mOpenDetailsOrAddContactImage.setOnClickListener(mAddToContactsClickHandler);
            mPhotoView.setOnClickListener(mAddToContactsClickHandler);
        } else {
            mOpenDetailsOrAddContactImage.setImageResource(R.drawable.ic_contacts_holo_dark);
            mOpenDetailsOrAddContactImage.setOnClickListener(mOpenDetailsClickHandler);
            mPhotoView.setOnClickListener(mOpenDetailsClickHandler);
        }
    }

    /**
     * Inflate the in-track view for the action of the given MIME-type, collapsing duplicate values.
     * Will use the icon provided by the {@link DataKind}.