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

Commit b6e3ecb7 authored by Wenyi Wang's avatar Wenyi Wang Committed by Android (Google) Code Review
Browse files

Merge "Fix NPE in getPhotos()" into ub-contactsdialer-b-dev

parents 1f4a6230 ab36017c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -904,6 +904,12 @@
         For example: Photo from Google abc@gmail.com checked. [CHAR LIMIT=60]-->
    <string name="photo_view_description_checked">Photo from <xliff:g id="account_type">%s </xliff:g><xliff:g id="user_name">%s </xliff:g>checked</string>

    <!-- Content description of photo in photo picker indicating a photo from unknown account is *not* selected.-->
    <string name="photo_view_description_not_checked_no_info">Photo from unknown account not checked</string>

    <!-- Content description of photo in photo picker indicating a photo from unknown account is selected. -->
    <string name="photo_view_description_checked_no_info">Photo from unknown account checked</string>

    <!-- Text shown in the contacts app while the background process updates contacts after a locale change [CHAR LIMIT=150]-->
    <string name="locale_change_in_progress">Contact list is being updated to reflect the change of language.\n\nPlease wait...</string>

+5 −11
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
@@ -96,8 +97,8 @@ public class CompactPhotoSelectionFragment extends Fragment {
        public int iconRes;
        public String syncAdapterPackageName;

        public String accountType;
        public String accountName;
        public String contentDescription;
        public String contentDescriptionChecked; // Talkback announcement when the photo is checked

        public ValuesDelta valuesDelta;

@@ -250,11 +251,7 @@ public class CompactPhotoSelectionFragment extends Fragment {
            final ImageView checkImageView = (ImageView) photoItemView.findViewById(R.id.check);
            checkImageView.setVisibility(photo.primary ? View.VISIBLE : View.GONE);

            final String contentDescription = getString(photo.primary ?
                    R.string.photo_view_description_checked :
                    R.string.photo_view_description_not_checked,
                    photo.accountType, photo.accountName == null ? "" : photo.accountName);
            photoItemView.setContentDescription(contentDescription);
            photoItemView.setContentDescription(photo.contentDescription);

            return photoItemView;
        }
@@ -343,10 +340,7 @@ public class CompactPhotoSelectionFragment extends Fragment {
            }
        });
        final ViewGroup clickedView = (ViewGroup) mGridView.getChildAt(position);
        final String contentDescription = getString(
                R.string.photo_view_description_checked,
                photo.accountType, photo.accountName == null ? "" : photo.accountName);
        clickedView.announceForAccessibility(contentDescription);
        clickedView.announceForAccessibility(photo.contentDescriptionChecked);
    }

    @Override
+22 −2
Original line number Diff line number Diff line
@@ -547,8 +547,6 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
                photo.primary = valuesDelta.isSuperPrimary();
                photo.kindSectionDataListIndex = i;
                photo.valuesDeltaListIndex = j;
                photo.accountType = accountType.getDisplayLabel(getContext()).toString();
                photo.accountName = kindSectionData.getRawContactDelta().getAccountName();
                photo.photoId = valuesDelta.getId();

                if (updatedPhotos != null) {
@@ -556,6 +554,28 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
                            kindSectionData.getRawContactDelta().getRawContactId()));
                }

                // set content descriptions of the photo
                final CharSequence accountTypeText = accountType.getDisplayLabel(getContext());
                if (accountTypeText != null) {
                    final String accountNameText =
                            kindSectionData.getRawContactDelta().getAccountName();
                    photo.contentDescription = getResources().getString(photo.primary ?
                                    R.string.photo_view_description_checked :
                                    R.string.photo_view_description_not_checked,
                            accountTypeText,
                            accountNameText == null ? "" : accountNameText);
                    photo.contentDescriptionChecked = getResources().getString(
                            R.string.photo_view_description_checked,
                            accountTypeText,
                            accountNameText == null ? "" : accountNameText);
                } else {
                    photo.contentDescription = getResources().getString(photo.primary ?
                            R.string.photo_view_description_checked_no_info :
                            R.string.photo_view_description_not_checked_no_info);
                    photo.contentDescriptionChecked = getResources().getString(
                            R.string.photo_view_description_checked_no_info);
                }

                photos.add(photo);
            }
        }