diff options
author | linyuh <linyuh@google.com> | 2018-06-07 17:34:13 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-07 18:43:10 -0700 |
commit | bac4da9d520846ab4e4f8cbcbb80927076deec27 (patch) | |
tree | c32cdaeff8e83f712332a27f603809686db53139 /java/com/android/dialer/glidephotomanager | |
parent | ecd339905308fd7101a6bf35d947bc6432e1b331 (diff) |
Wrap phone numbers in custom content descriptions in the new call log with TTS span.
Bug: 70989658
Test: Manual (TTS span is not testable)
PiperOrigin-RevId: 199724621
Change-Id: I6dc809660eecdd987ee966f30b68dbbf7bcf2094
Diffstat (limited to 'java/com/android/dialer/glidephotomanager')
-rw-r--r-- | java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java | 10 | ||||
-rw-r--r-- | java/com/android/dialer/glidephotomanager/impl/res/values/strings.xml | 26 |
2 files changed, 33 insertions, 3 deletions
diff --git a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java index bd9cc31e4..9129e588f 100644 --- a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java +++ b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java @@ -34,6 +34,7 @@ import com.android.dialer.glide.GlideRequest; import com.android.dialer.glide.GlideRequests; import com.android.dialer.glidephotomanager.GlidePhotoManager; import com.android.dialer.glidephotomanager.PhotoInfo; +import com.android.dialer.i18n.DialerBidiFormatter; import com.android.dialer.inject.ApplicationContext; import com.android.dialer.lettertile.LetterTileDrawable; import java.util.List; @@ -69,9 +70,12 @@ public class GlidePhotoManagerImpl implements GlidePhotoManager { public void loadContactPhoto(ImageView imageView, PhotoInfo photoInfo) { Assert.isMainThread(); imageView.setContentDescription( - appContext.getString( - com.android.dialer.contactphoto.R.string.description_quick_contact_for, - photoInfo.getName())); + TextUtils.expandTemplate( + appContext.getText(R.string.a11y_glide_photo_manager_contact_photo_description), + // The display name in "photoInfo" can be a contact name, a number, or a mixture of text + // and a phone number. We use DialerBidiFormatter to wrap the phone number with TTS + // span. + DialerBidiFormatter.format(photoInfo.getName()))); GlideRequest<Drawable> request = buildRequest(GlideApp.with(imageView), photoInfo); request.into(imageView); } diff --git a/java/com/android/dialer/glidephotomanager/impl/res/values/strings.xml b/java/com/android/dialer/glidephotomanager/impl/res/values/strings.xml new file mode 100644 index 000000000..217ad6061 --- /dev/null +++ b/java/com/android/dialer/glidephotomanager/impl/res/values/strings.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <!-- + String describing to a11y users the image view containing a contact photo loaded by + GlidePhotoManager [CHAR LIMIT=NONE] + --> + <string name="a11y_glide_photo_manager_contact_photo_description"> + Quick contact for <xliff:g example="Jane Smith" id="name">^1</xliff:g> + </string> +</resources>
\ No newline at end of file |