From 4a8890f37496bf669734772068b3d684007c42f9 Mon Sep 17 00:00:00 2001 From: linyuh Date: Wed, 16 May 2018 16:18:46 -0700 Subject: Implement accessibility for the new voicemail fragment. Bug: 70989658 Test: Manual PiperOrigin-RevId: 196907085 Change-Id: If3db2d6906245f052e756b315365b9d306f9d06d --- .../voicemail/datasources/VoicemailData.java | 53 ---------------------- .../voicemail/listui/NewVoicemailAdapter.java | 11 +---- .../voicemail/listui/NewVoicemailFragment.java | 6 +-- .../voicemail/listui/NewVoicemailViewHolder.java | 17 ++----- .../layout/voicemail_error_message_fragment.xml | 14 +++--- .../listui/res/layout/new_voicemail_entry.xml | 41 ++++++++--------- .../res/layout/new_voicemail_entry_alert.xml | 5 +- .../layout/new_voicemail_media_player_layout.xml | 6 ++- .../dialer/voicemail/listui/res/values/strings.xml | 29 ++++++++++++ .../widget/res/layout/contact_photo_view.xml | 18 +++----- 10 files changed, 79 insertions(+), 121 deletions(-) delete mode 100644 java/com/android/dialer/voicemail/datasources/VoicemailData.java diff --git a/java/com/android/dialer/voicemail/datasources/VoicemailData.java b/java/com/android/dialer/voicemail/datasources/VoicemailData.java deleted file mode 100644 index c3c1ff51b..000000000 --- a/java/com/android/dialer/voicemail/datasources/VoicemailData.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2017 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 - */ - -package com.android.dialer.voicemail.datasources; - -import com.google.auto.value.AutoValue; - -/** Dummy voicemail data class to allow us to work on the UI for the new voicemail tab. */ -@AutoValue -public abstract class VoicemailData { - public abstract String name(); - - public abstract String location(); - - public abstract String date(); - - public abstract String duration(); - - public abstract String transcription(); - - public static Builder builder() { - return new AutoValue_VoicemailData.Builder(); - } - - /** Creates instances of {@link VoicemailData}. */ - @AutoValue.Builder - public abstract static class Builder { - public abstract Builder setName(String value); - - public abstract Builder setLocation(String value); - - public abstract Builder setDate(String value); - - public abstract Builder setDuration(String value); - - public abstract Builder setTranscription(String value); - - public abstract VoicemailData build(); - } -} diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java b/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java index 64f63d9bc..5b2f0619f 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailAdapter.java @@ -44,7 +44,6 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.ThreadUtil; -import com.android.dialer.glidephotomanager.GlidePhotoManager; import com.android.dialer.time.Clock; import com.android.dialer.voicemail.listui.NewVoicemailViewHolder.NewVoicemailViewHolderListener; import com.android.dialer.voicemail.listui.error.VoicemailErrorMessage; @@ -79,7 +78,6 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter private Cursor cursor; private final Clock clock; - private final GlidePhotoManager glidePhotoManager; /** {@link Integer#MAX_VALUE} when the "Today" header should not be displayed. */ private int todayHeaderPosition = Integer.MAX_VALUE; @@ -122,16 +120,11 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter new NewVoicemailMediaPlayer(new MediaPlayer()); /** @param cursor whose projection is {@link VoicemailCursorLoader#VOICEMAIL_COLUMNS} */ - NewVoicemailAdapter( - Cursor cursor, - Clock clock, - FragmentManager fragmentManager, - GlidePhotoManager glidePhotoManager) { + NewVoicemailAdapter(Cursor cursor, Clock clock, FragmentManager fragmentManager) { LogUtil.enterBlock("NewVoicemailAdapter"); this.cursor = cursor; this.clock = clock; this.fragmentManager = fragmentManager; - this.glidePhotoManager = glidePhotoManager; initializeMediaPlayerListeners(); updateHeaderPositions(); } @@ -233,7 +226,7 @@ final class NewVoicemailAdapter extends RecyclerView.Adapter case NewVoicemailAdapter.RowType.VOICEMAIL_ENTRY: view = inflater.inflate(R.layout.new_voicemail_entry, viewGroup, false); NewVoicemailViewHolder newVoicemailViewHolder = - new NewVoicemailViewHolder(view, clock, this, glidePhotoManager); + new NewVoicemailViewHolder(view, clock, this); newVoicemailViewHolderSet.add(newVoicemailViewHolder); return newVoicemailViewHolder; default: diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java index 72f0ab542..b2052c61e 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailFragment.java @@ -36,7 +36,6 @@ import com.android.dialer.calllog.RefreshAnnotatedCallLogReceiver; import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.common.concurrent.UiListener; -import com.android.dialer.glidephotomanager.GlidePhotoManagerComponent; import com.android.dialer.voicemail.listui.error.VoicemailStatus; import com.android.dialer.voicemailstatus.VoicemailStatusQuery; import com.android.dialer.widget.EmptyContentView; @@ -184,10 +183,7 @@ public final class NewVoicemailFragment extends Fragment implements LoaderCallba // TODO(uabdullah): Replace getActivity().getFragmentManager() with getChildFragment() recyclerView.setAdapter( new NewVoicemailAdapter( - data, - System::currentTimeMillis, - getActivity().getFragmentManager(), - GlidePhotoManagerComponent.get(getContext()).glidePhotoManager())); + data, System::currentTimeMillis, getActivity().getFragmentManager())); } else { // This would only be called in cases such as when voicemail has been fetched from the server // or a changed occurred in the annotated table changed (e.g deletes). To check if the change diff --git a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java index 66e2195b7..c001c0059 100644 --- a/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java +++ b/java/com/android/dialer/voicemail/listui/NewVoicemailViewHolder.java @@ -34,7 +34,6 @@ import android.util.Pair; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; -import android.widget.QuickContactBadge; import android.widget.TextView; import com.android.dialer.calllog.database.contract.AnnotatedCallLogContract.AnnotatedCallLog; import com.android.dialer.calllogutils.NumberAttributesConverter; @@ -44,10 +43,10 @@ import com.android.dialer.common.concurrent.DialerExecutor.SuccessListener; import com.android.dialer.common.concurrent.DialerExecutor.Worker; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.compat.android.provider.VoicemailCompat; -import com.android.dialer.glidephotomanager.GlidePhotoManager; import com.android.dialer.time.Clock; import com.android.dialer.voicemail.listui.menu.NewVoicemailMenu; import com.android.dialer.voicemail.model.VoicemailEntry; +import com.android.dialer.widget.ContactPhotoView; import com.android.voicemail.VoicemailClient; /** {@link RecyclerView.ViewHolder} for the new voicemail tab. */ @@ -58,7 +57,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On private final TextView secondaryTextView; private final TextView transcriptionTextView; private final TextView transcriptionBrandingTextView; - private final QuickContactBadge quickContactBadge; + private final ContactPhotoView contactPhotoView; private final NewVoicemailMediaPlayerView mediaPlayerView; private final ImageView menuButton; private final Clock clock; @@ -67,13 +66,9 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On private VoicemailEntry voicemailEntryOfViewHolder; @NonNull private Uri viewHolderVoicemailUri; private final NewVoicemailViewHolderListener voicemailViewHolderListener; - private final GlidePhotoManager glidePhotoManager; NewVoicemailViewHolder( - View view, - Clock clock, - NewVoicemailViewHolderListener newVoicemailViewHolderListener, - GlidePhotoManager glidePhotoManager) { + View view, Clock clock, NewVoicemailViewHolderListener newVoicemailViewHolderListener) { super(view); LogUtil.enterBlock("NewVoicemailViewHolder"); this.context = view.getContext(); @@ -81,12 +76,11 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On secondaryTextView = view.findViewById(R.id.secondary_text); transcriptionTextView = view.findViewById(R.id.transcription_text); transcriptionBrandingTextView = view.findViewById(R.id.transcription_branding); - quickContactBadge = view.findViewById(R.id.quick_contact_photo); + contactPhotoView = view.findViewById(R.id.contact_photo_view); mediaPlayerView = view.findViewById(R.id.new_voicemail_media_player); menuButton = view.findViewById(R.id.menu_button); this.clock = clock; voicemailViewHolderListener = newVoicemailViewHolderListener; - this.glidePhotoManager = glidePhotoManager; viewHolderId = -1; isViewHolderExpanded = false; @@ -213,8 +207,7 @@ final class NewVoicemailViewHolder extends RecyclerView.ViewHolder implements On } private void setPhoto(VoicemailEntry voicemailEntry) { - glidePhotoManager.loadQuickContactBadge( - quickContactBadge, + contactPhotoView.setPhoto( NumberAttributesConverter.toPhotoInfoBuilder(voicemailEntry.getNumberAttributes()) .setFormattedNumber(voicemailEntry.getFormattedNumber()) .build()); diff --git a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml index 4bea8b152..7e74bae10 100644 --- a/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml +++ b/java/com/android/dialer/voicemail/listui/error/res/layout/voicemail_error_message_fragment.xml @@ -15,6 +15,7 @@ --> + android:importantForAccessibility="no" + android:src="@drawable/ic_voicemail_error_24px" + tools:ignore="ContentDescription"/> + android:paddingEnd="@dimen/alert_action_between_padding" + android:clickable="true" + android:nextFocusForward="@+id/secondary_action"/> + android:nextFocusForward="@+id/promo_card"/> diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml index 8dbe96117..b880e0ffc 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry.xml @@ -17,23 +17,23 @@ - + @@ -42,9 +42,8 @@ style="@style/PrimaryText" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_marginEnd="6dp" android:layout_marginTop="14dp" + android:layout_marginEnd="6dp" android:ellipsize="end" android:lineSpacingMultiplier="1.5" android:singleLine="true"/> @@ -52,16 +51,18 @@ + android:orientation="horizontal" + tools:ignore="UseCompoundDrawables"> + tools:ignore="ContentDescription"/> - + android:visibility="gone"/> diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_alert.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_alert.xml index 18a368647..c7029516b 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_alert.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_entry_alert.xml @@ -18,6 +18,7 @@ + android:importantForAccessibility="no" + android:src="@drawable/ic_voicemail_error_24px" + tools:ignore="ContentDescription"/> @@ -81,6 +82,7 @@ android:id="@+id/playButton" style="@style/voicemail_media_player_buttons" android:layout_weight="1" + android:contentDescription="@string/a11y_voicemail_entry_play" android:src="@drawable/quantum_ic_play_arrow_vd_theme_24"/> @@ -88,6 +90,7 @@ android:id="@+id/speakerButton" style="@style/voicemail_media_player_buttons" android:layout_weight="1" + android:contentDescription="@string/a11y_voicemail_entry_speaker" android:src="@drawable/quantum_ic_volume_up_vd_theme_24"/> @@ -95,13 +98,14 @@ android:id="@+id/phoneButton" style="@style/voicemail_media_player_buttons" android:layout_weight="1" + android:contentDescription="@string/a11y_voicemail_entry_call" android:src="@drawable/quantum_ic_phone_vd_theme_24"/> - \ No newline at end of file diff --git a/java/com/android/dialer/voicemail/listui/res/values/strings.xml b/java/com/android/dialer/voicemail/listui/res/values/strings.xml index dc54daa19..bfa81f731 100644 --- a/java/com/android/dialer/voicemail/listui/res/values/strings.xml +++ b/java/com/android/dialer/voicemail/listui/res/values/strings.xml @@ -15,6 +15,35 @@ ~ limitations under the License --> + + Call number + + + Delete + + + + Expand menu for this voicemail entry + + + + Pause + + + Play + + + Speaker + Unknown diff --git a/java/com/android/dialer/widget/res/layout/contact_photo_view.xml b/java/com/android/dialer/widget/res/layout/contact_photo_view.xml index 0a8b80e02..320d06b98 100644 --- a/java/com/android/dialer/widget/res/layout/contact_photo_view.xml +++ b/java/com/android/dialer/widget/res/layout/contact_photo_view.xml @@ -28,32 +28,30 @@ android:layout_width="48dp" android:layout_height="48dp" android:layout_gravity="center" - android:padding="4dp" - android:focusable="true"/> + android:padding="4dp"/> + android:layout_marginEnd="2dp" + android:layout_gravity="bottom|end" + android:importantForAccessibility="noHideDescendants"> \ No newline at end of file -- cgit v1.2.3