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

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

Merge "Update content description after updating primary" into nyc-dev

parents 4ca968b1 d375c35c
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -261,6 +261,25 @@ public class CompactContactEditorFragment extends ContactEditorBaseFragment impl
            } else {
                photo.primary = false;
            }
            updateContentDescription(photo);
        }
    }

    private void updateContentDescription(CompactPhotoSelectionFragment.Photo photo) {
        if (!TextUtils.isEmpty(photo.accountType)) {
            photo.contentDescription = getResources().getString(photo.primary ?
                            R.string.photo_view_description_checked :
                            R.string.photo_view_description_not_checked,
                    photo.accountType, photo.accountName);
            photo.contentDescriptionChecked = getResources().getString(
                    R.string.photo_view_description_checked,
                    photo.accountType, photo.accountName);
        } 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);
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -95,6 +95,8 @@ public class CompactPhotoSelectionFragment extends Fragment {

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

        public ValuesDelta valuesDelta;

+4 −21
Original line number Diff line number Diff line
@@ -554,27 +554,10 @@ 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);
                }
                final CharSequence accountTypeLabel = accountType.getDisplayLabel(getContext());
                photo.accountType = accountTypeLabel == null ? "" : accountTypeLabel.toString();
                final String accountName = kindSectionData.getRawContactDelta().getAccountName();
                photo.accountName = accountName == null ? "" : accountName;

                photos.add(photo);
            }