diff options
10 files changed, 79 insertions, 121 deletions
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<ViewHolder> 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<ViewHolder> 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<ViewHolder> 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.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/error_card" style="@style/CallLogCardStyle" android:gravity="center_vertical" @@ -41,7 +42,9 @@ android:layout_width="@dimen/voicemail_promo_card_icon_size" android:layout_height="@dimen/voicemail_promo_card_icon_size" android:layout_gravity="top" - android:src="@drawable/ic_voicemail_error_24px"/> + android:importantForAccessibility="no" + android:src="@drawable/ic_voicemail_error_24px" + tools:ignore="ContentDescription"/> <LinearLayout android:layout_width="match_parent" @@ -82,10 +85,10 @@ <TextView android:id="@+id/secondary_action_raised" style="@style/RaisedErrorActionStyle" - android:paddingEnd="@dimen/alert_action_between_padding" android:layout_marginEnd="8dp" - android:nextFocusForward="@+id/secondary_action" - android:clickable="true"/> + android:paddingEnd="@dimen/alert_action_between_padding" + android:clickable="true" + android:nextFocusForward="@+id/secondary_action"/> <TextView android:id="@+id/secondary_action" @@ -103,9 +106,8 @@ <TextView android:id="@+id/primary_action_raised" style="@style/RaisedErrorActionStyle" - android:nextFocusForward="@+id/promo_card" android:clickable="true" - /> + android:nextFocusForward="@+id/promo_card"/> </LinearLayout> </LinearLayout> 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 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="72dp"> - <QuickContactBadge - android:id="@+id/quick_contact_photo" - android:layout_width="40dp" - android:layout_height="40dp" - android:layout_marginTop="16dp" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:focusable="true"/> + <com.android.dialer.widget.ContactPhotoView + android:id="@+id/contact_photo_view" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_toEndOf="@+id/quick_contact_photo" + android:layout_toEndOf="@+id/contact_photo_view" android:layout_toStartOf="@+id/menu_button" android:orientation="vertical"> @@ -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 @@ <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:orientation="horizontal"> + android:orientation="horizontal" + tools:ignore="UseCompoundDrawables"> <ImageView android:layout_width="wrap_content" android:layout_height="18dp" android:layout_gravity="center_vertical" + android:importantForAccessibility="no" android:src="@drawable/quantum_ic_voicemail_vd_theme_24" android:tint="@color/dialtacts_theme_color" android:tintMode="multiply" - /> + tools:ignore="ContentDescription"/> <TextView android:id="@+id/secondary_text" @@ -97,22 +98,16 @@ android:id="@+id/new_voicemail_media_player" android:layout_width="match_parent" android:layout_height="wrap_content" - android:visibility="gone" - /> - + android:visibility="gone"/> </LinearLayout> <ImageView android:id="@+id/menu_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="12dp" - android:layout_marginBottom="12dp" - android:layout_marginStart="4dp" - android:layout_marginEnd="4dp" + android:layout_width="56dp" + android:layout_height="72dp" android:layout_alignParentEnd="true" - android:padding="12dp" android:background="?android:attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/a11y_voicemail_entry_expand_menu" android:scaleType="center" android:src="@drawable/quantum_ic_more_vert_vd_theme_24" android:tint="@color/dialer_secondary_text_color"/> 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 @@ <!-- TODO(uabdullah): Use a relative layout instead of nested linear layouts.--> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/voicemail_alert_content" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -38,7 +39,9 @@ android:layout_width="@dimen/voicemail_promo_card_icon_size" android:layout_height="@dimen/voicemail_promo_card_icon_size" android:layout_gravity="top" - android:src="@drawable/ic_voicemail_error_24px"/> + android:importantForAccessibility="no" + android:src="@drawable/ic_voicemail_error_24px" + tools:ignore="ContentDescription"/> <LinearLayout android:layout_width="match_parent" diff --git a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml index 3efcea543..279614291 100644 --- a/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml +++ b/java/com/android/dialer/voicemail/listui/res/layout/new_voicemail_media_player_layout.xml @@ -74,6 +74,7 @@ android:id="@+id/pauseButton" style="@style/voicemail_media_player_buttons" android:layout_weight="1" + android:contentDescription="@string/a11y_voicemail_entry_pause" android:src="@drawable/quantum_ic_pause_vd_theme_24" android:visibility="gone"/> @@ -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"/> <ImageButton android:id="@+id/deleteButton" style="@style/voicemail_media_player_buttons" android:layout_weight="1" + android:contentDescription="@string/a11y_voicemail_entry_delete" android:src="@drawable/quantum_ic_delete_vd_theme_24"/> - </LinearLayout> </LinearLayout>
\ 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 --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- + A string to describe available action for accessibility user. It will be read as "call number". + --> + <string name="a11y_voicemail_entry_call">Call number</string> + + <!-- + A string to describe available action for accessibility user. It will be read as "delete". + --> + <string name="a11y_voicemail_entry_delete">Delete</string> + + <!-- + A string to describe available action for accessibility user. + It will be read as "expand menu for this voicemail entry". + --> + <string name="a11y_voicemail_entry_expand_menu"> + Expand menu for this voicemail entry + </string> + + <!-- A string to describe available action for accessibility user. It will be read as "pause". --> + <string name="a11y_voicemail_entry_pause">Pause</string> + + <!-- A string to describe available action for accessibility user. It will be read as "play". --> + <string name="a11y_voicemail_entry_play">Play</string> + + <!-- + A string to describe available action for accessibility user. It will be read as "speaker". + --> + <string name="a11y_voicemail_entry_speaker">Speaker</string> + <!-- String used to display voicemails from unknown numbers in the voicemail tab. [CHAR LIMIT=30] --> <string name="voicemail_entry_unknown">Unknown</string> 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"/> <!-- A container layout that contains a background and badges (video call badge, RTT call badge, etc) The container and its children are too small to meet the accessibility requirement that the - touchable area of focusable items should be at least 48dp x 48dp. We have to set all of them - to be not focusable. + touchable area of focusable items should be at least 48dp x 48dp. We have to mark all of them + as not important for accessibility. --> <FrameLayout android:id="@+id/contact_badge_container" android:layout_width="22dp" android:layout_height="22dp" - android:layout_gravity="bottom|end" - android:layout_marginEnd="2dp" android:layout_marginBottom="2dp" - android:focusable="false"> + android:layout_marginEnd="2dp" + android:layout_gravity="bottom|end" + android:importantForAccessibility="noHideDescendants"> <ImageView android:id="@+id/contact_badge_background" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/contact_photo_badge_background" - android:focusable="false" tools:ignore="ContentDescription"/> <ImageView @@ -62,7 +60,6 @@ android:layout_height="13dp" android:layout_gravity="center" android:src="@drawable/quantum_ic_videocam_vd_white_24" - android:focusable="false" tools:ignore="ContentDescription"/> <ImageView @@ -70,9 +67,8 @@ android:layout_width="13dp" android:layout_height="13dp" android:layout_gravity="center" - android:tint="@android:color/white" android:src="@drawable/quantum_ic_rtt_vd_theme_24" - android:focusable="false" + android:tint="@android:color/white" tools:ignore="ContentDescription"/> </FrameLayout> </FrameLayout>
\ No newline at end of file |