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

Commit 41742adb authored by Wenyi Wang's avatar Wenyi Wang Committed by android-build-merger
Browse files

Merge "Unset super primary of writable accounts photos" into ub-contactsdialer-a-dev am: 3184fc86

am: 6a8db556

* commit '6a8db556':
  Unset super primary of writable accounts photos
parents d5a58a2f 6a8db556
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -464,7 +464,7 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
    public void updatePhoto(Uri photoUri) {
        mPhotoValuesDelta.setFromTemplate(false);
        // Unset primary for all photos
        unsetSuperPrimaryFromAllWritablePhotos();
        unsetSuperPrimaryFromAllPhotos();
        // Mark the currently displayed photo as primary
        mPhotoValuesDelta.setSuperPrimary(true);

@@ -487,17 +487,15 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
        mPhotoView.setFullSizedPhoto(photoUri);
    }

    private void unsetSuperPrimaryFromAllWritablePhotos() {
    private void unsetSuperPrimaryFromAllPhotos() {
        final List<KindSectionData> kindSectionDataList =
                mKindSectionDataMap.get(Photo.CONTENT_ITEM_TYPE);
        for (KindSectionData kindSectionData : kindSectionDataList) {
            if (kindSectionData.getAccountType().areContactsWritable()) {
            for (ValuesDelta valuesDelta : kindSectionData.getNonEmptyValuesDeltas()) {
                valuesDelta.setSuperPrimary(false);
            }
        }
    }
    }

    /**
     * Pass through to {@link CompactPhotoEditorView#isWritablePhotoSet}.
@@ -587,7 +585,7 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
        final ValuesDelta valuesDelta = valuesDeltaList.get(photo.valuesDeltaListIndex);
        valuesDelta.setFromTemplate(false);
        // Unset primary for all photos
        unsetSuperPrimaryFromAllWritablePhotos();
        unsetSuperPrimaryFromAllPhotos();
        // Mark the currently displayed photo as primary
        valuesDelta.setSuperPrimary(true);
        // Update the UI