diff options
author | Eric Erfanian <erfanian@google.com> | 2018-05-30 16:17:27 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-30 16:17:27 +0000 |
commit | 2c3d81eeac82472d06027bc65d661e16735c8608 (patch) | |
tree | 293aeb0012d8db8f3f4606a75a422cf4da328477 /java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java | |
parent | 4efd0ebf003e985e7cbe40d8ffd9f7ff227a9611 (diff) | |
parent | 152c3fd58f83a1882bcdc8bc55f46bbb8f3173c9 (diff) |
Merge changes Ica13ee39,I5e0fedc8,I8e7efad0,I0ecc1f91,Iee1e658a, ...
* changes:
Drop maps.impl from packages.mk
Check if ID column is null before retrieving data from the smart dial database.
Rename theme/private to theme/hidden.
Some improvements to the answer fragment layouts.
Better a11y for the bottom sheet.
Fix a few UI bugs.
Log IMS video call available state
Better a11y for contact badge in the new call log.
Use lookup key to determine the letter tile color
Use Dialer Light Theme for SpeakEasyFragment
Better a11y for new call log entries.
Use Maps SDK lite mode instead of static API for emergency call.
Updating locations where PrimaryInfo#setPhoto is used to also PrimaryInfo#setPhotoUri for new GlidePhotoManager implementation. As part of this addition, we also are cleaning the setPhoto(null) because this is not explicitly needed.
Converted ThemeUtil into a DaggerModule.
Delete AppCompatConstants
Remove photo support in PhoneNumberService
Began implementation of Dialer dark theme.
Diffstat (limited to 'java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java')
-rw-r--r-- | java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index 357c623da..cdc0858da 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -26,18 +26,21 @@ import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; import android.view.View; +import android.view.View.AccessibilityDelegate; +import android.view.accessibility.AccessibilityNodeInfo; +import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.widget.ImageView; import android.widget.TextView; import com.android.dialer.calllog.database.Coalescer; import com.android.dialer.calllog.model.CoalescedRow; import com.android.dialer.calllog.ui.NewCallLogAdapter.PopCounts; import com.android.dialer.calllog.ui.menu.NewCallLogMenu; +import com.android.dialer.calllogutils.CallLogEntryDescriptions; import com.android.dialer.calllogutils.CallLogEntryText; import com.android.dialer.calllogutils.CallLogRowActions; import com.android.dialer.calllogutils.PhoneAccountUtils; import com.android.dialer.calllogutils.PhotoInfoBuilder; import com.android.dialer.common.concurrent.DialerExecutorComponent; -import com.android.dialer.compat.AppCompatConstants; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.oem.MotorolaUtils; import com.android.dialer.phonenumberutil.PhoneNumberHelper; @@ -63,6 +66,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private final ImageView assistedDialIcon; private final TextView phoneAccountView; private final ImageView menuButton; + private final View callLogEntryRootView; private final Clock clock; private final RealtimeRowProcessor realtimeRowProcessor; @@ -79,6 +83,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { PopCounts popCounts) { super(view); this.activity = activity; + callLogEntryRootView = view; contactPhotoView = view.findViewById(R.id.contact_photo_view); primaryTextView = view.findViewById(R.id.primary_text); callCountTextView = view.findViewById(R.id.call_count); @@ -108,6 +113,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { // what information we have, rather than an empty card. For example, if CP2 information needs to // be queried on the fly, we can still show the phone number until the contact name loads. displayRow(row); + configA11yForRow(row); // Note: This leaks the view holder via the callback (which is an inner class), but this is OK // because we only create ~10 of them (and they'll be collected assuming all jobs finish). @@ -143,6 +149,28 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { setOnClickListenerForMenuButon(row); } + private void configA11yForRow(CoalescedRow row) { + callLogEntryRootView.setContentDescription( + CallLogEntryDescriptions.buildDescriptionForEntry(activity, clock, row)); + + // Inform a11y users that double tapping an entry now makes a call. + // This will instruct TalkBack to say "double tap to call" instead of + // "double tap to activate". + callLogEntryRootView.setAccessibilityDelegate( + new AccessibilityDelegate() { + @Override + public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(host, info); + info.addAction( + new AccessibilityAction( + AccessibilityNodeInfo.ACTION_CLICK, + activity + .getResources() + .getString(R.string.a11y_new_call_log_entry_tap_action))); + } + }); + } + private void setNumberCalls(CoalescedRow row) { int numberCalls = row.getCoalescedIds().getCoalescedIdCount(); if (numberCalls > 1) { @@ -161,7 +189,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { } private void setPhoto(CoalescedRow row) { - contactPhotoView.setPhoto(PhotoInfoBuilder.fromCoalescedRow(row).build()); + contactPhotoView.setPhoto(PhotoInfoBuilder.fromCoalescedRow(activity, row).build()); } private void setFeatureIcons(CoalescedRow row) { @@ -201,19 +229,19 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private void setCallTypeIcon(CoalescedRow row) { @DrawableRes int resId; switch (row.getCallType()) { - case AppCompatConstants.CALLS_INCOMING_TYPE: - case AppCompatConstants.CALLS_ANSWERED_EXTERNALLY_TYPE: + case Calls.INCOMING_TYPE: + case Calls.ANSWERED_EXTERNALLY_TYPE: resId = R.drawable.quantum_ic_call_received_vd_theme_24; break; - case AppCompatConstants.CALLS_OUTGOING_TYPE: + case Calls.OUTGOING_TYPE: resId = R.drawable.quantum_ic_call_made_vd_theme_24; break; - case AppCompatConstants.CALLS_MISSED_TYPE: + case Calls.MISSED_TYPE: resId = R.drawable.quantum_ic_call_missed_vd_theme_24; break; - case AppCompatConstants.CALLS_VOICEMAIL_TYPE: + case Calls.VOICEMAIL_TYPE: throw new IllegalStateException("Voicemails not expected in call log"); - case AppCompatConstants.CALLS_BLOCKED_TYPE: + case Calls.BLOCKED_TYPE: resId = R.drawable.quantum_ic_block_vd_theme_24; break; default: @@ -275,6 +303,12 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private void setOnClickListenerForMenuButon(CoalescedRow row) { menuButton.setOnClickListener(NewCallLogMenu.createOnClickListener(activity, row)); + menuButton.setContentDescription( + activity + .getResources() + .getString( + R.string.a11y_new_call_log_entry_expand_menu, + CallLogEntryText.buildPrimaryText(activity, row))); } private class RealtimeRowFutureCallback implements FutureCallback<CoalescedRow> { |