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

Commit 1bff1f6f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Implement accessibility for the new voicemail fragment."

parents b86b1a29 4a8890f3
Loading
Loading
Loading
Loading
+0 −53
Original line number Diff line number Diff line
/*
 * 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();
  }
}
+2 −9
Original line number Diff line number Diff line
@@ -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:
+1 −5
Original line number Diff line number Diff line
@@ -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
+5 −12
Original line number Diff line number Diff line
@@ -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());
+8 −6
Original line number Diff line number Diff line
@@ -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>
Loading