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 | |
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')
10 files changed, 86 insertions, 56 deletions
diff --git a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java index ec6e8a0fd..4b3697017 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java @@ -238,7 +238,6 @@ public final class NewCallLogFragment extends Fragment implements LoaderCallback private void configureEmptyContentView() { emptyContentView.setImage(R.drawable.quantum_ic_query_builder_vd_theme_24); - emptyContentView.setImageTint(R.color.empty_call_log_icon_tint_color, null); emptyContentView.setDescription(R.string.new_call_log_permission_no_calllog); emptyContentView.setActionLabel(com.android.dialer.widget.R.string.permission_single_turn_on); emptyContentView.setActionClickedListener(new TurnOnPhonePermissions()); 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> { diff --git a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java index 25ae47691..6d0b7951f 100644 --- a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java +++ b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java @@ -28,7 +28,7 @@ final class BottomSheetHeader { static HistoryItemBottomSheetHeaderInfo fromRow(Context context, CoalescedRow row) { return HistoryItemBottomSheetHeaderInfo.newBuilder() .setNumber(row.getNumber()) - .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(row)) + .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(context, row)) .setPrimaryText(CallLogEntryText.buildPrimaryText(context, row).toString()) .setSecondaryText( CallLogEntryText.buildSecondaryTextForBottomSheet(context, row).toString()) diff --git a/java/com/android/dialer/calllog/ui/menu/Modules.java b/java/com/android/dialer/calllog/ui/menu/Modules.java index ded495807..7c6c65ca9 100644 --- a/java/com/android/dialer/calllog/ui/menu/Modules.java +++ b/java/com/android/dialer/calllog/ui/menu/Modules.java @@ -88,7 +88,7 @@ final class Modules { Context context, CoalescedRow row) { return CallDetailsHeaderInfo.newBuilder() .setDialerPhoneNumber(row.getNumber()) - .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(row)) + .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(context, row)) .setPrimaryText(CallLogEntryText.buildPrimaryText(context, row).toString()) .setSecondaryText( CallLogEntryText.buildSecondaryTextForBottomSheet(context, row).toString()) diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml index 1bd71bb0f..726c53bc1 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml @@ -30,13 +30,19 @@ android:layout_marginEnd="8dp" android:layout_centerVertical="true"/> + <!-- + A vertical linear layout of three rows: primary info, secondary info, and phone account info. + It is marked as not important for a11y as we will set a more user-friendly content description + for the entire entry view in Java code. + --> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toEndOf="@+id/contact_photo_view" android:layout_toStartOf="@+id/menu_button" - android:orientation="vertical"> + android:orientation="vertical" + android:importantForAccessibility="noHideDescendants"> <!-- 1st row: primary info --> <LinearLayout @@ -60,14 +66,12 @@ --> <TextView android:id="@+id/primary_text" - style="@style/Dialer.TextAppearance.Primary" + style="@style/Dialer.TextAppearance.Primary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:layout_marginEnd="6dp" - android:ellipsize="end" android:lineSpacingMultiplier="1.5" - android:singleLine="true" tools:ignore="InefficientWeight"/> <ImageView @@ -120,26 +124,26 @@ <TextView android:id="@+id/secondary_text" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:ellipsize="end" - android:lineSpacingMultiplier="1.4" - android:singleLine="true"/> + android:lineSpacingMultiplier="1.4"/> </LinearLayout> <!-- 3rd row: phone account info --> <TextView android:id="@+id/phone_account" - style="@style/Dialer.TextAppearance.Secondary" + style="@style/Dialer.TextAppearance.Secondary.Ellipsize" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:ellipsize="end" - android:singleLine="true"/> + android:layout_height="wrap_content"/> </LinearLayout> + <!-- + The button to expand the bottom sheet for an entry. + Its content description is set in Java code. + --> <ImageView android:id="@+id/menu_button" android:layout_width="56dp" @@ -147,8 +151,8 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:background="?android:attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/a11y_new_call_log_expand_menu_for_entry" android:scaleType="center" android:src="@drawable/quantum_ic_more_vert_vd_theme_24" - android:tint="@color/dialer_secondary_text_color"/> + android:tint="?colorIcon" + tools:ignore="ContentDescription"/> </RelativeLayout> diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_header.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_header.xml index e86ece534..a6d1f61f1 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_header.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_header.xml @@ -21,7 +21,7 @@ android:layout_height="wrap_content"> <TextView android:id="@+id/new_call_log_header_text" - style="@style/SubHeader" + style="@style/Dialer.TextAppearance.Secondary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml index 0e6d551fb..fade6c7b9 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_promotion_card.xml @@ -49,17 +49,14 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="12dp" - android:fontFamily="sans-serif-medium" - android:textColor="@color/primary_material_dark" - android:textSize="@dimen/call_log_primary_text_size"/> + style="@style/Dialer.TextAppearance.Header2"/> <TextView android:id="@+id/new_call_log_promotion_card_details" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:lineSpacingExtra="8dp" - android:textColor="@color/primary_material_dark" - android:textSize="14sp"/> + style="@style/Dialer.TextAppearance.Secondary"/> <Button android:id="@+id/new_call_log_promotion_card_ok" android:layout_width="wrap_content" diff --git a/java/com/android/dialer/calllog/ui/res/values/colors.xml b/java/com/android/dialer/calllog/ui/res/values/colors.xml index 002aaf959..27a821e10 100644 --- a/java/com/android/dialer/calllog/ui/res/values/colors.xml +++ b/java/com/android/dialer/calllog/ui/res/values/colors.xml @@ -16,11 +16,10 @@ --> <resources> + <!-- TODO(a bug): remove these? --> <color name="feature_icon_read_color">#9E9E9E</color> <color name="feature_icon_unread_color">#474747</color> <color name="call_type_icon_read_color">#757575</color> <color name="call_type_icon_unread_color">#D32F2F</color> - - <color name="empty_call_log_icon_tint_color">#E1E1E1</color> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/calllog/ui/res/values/strings.xml b/java/com/android/dialer/calllog/ui/res/values/strings.xml index 3888eb90d..112044f6e 100644 --- a/java/com/android/dialer/calllog/ui/res/values/strings.xml +++ b/java/com/android/dialer/calllog/ui/res/values/strings.xml @@ -16,12 +16,21 @@ --> <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 "expand menu for this call log entry". + A string informing a11y users that activating a call log entry will place a call. + Note: the word "call" here is a verb. + [CHAR LIMIT=NONE] --> - <string name="a11y_new_call_log_expand_menu_for_entry"> - Expand menu for this call log entry + <string name="a11y_new_call_log_entry_tap_action">call</string> + + <!-- + A string describing the menu button of a call log entry for a11y users. + An example will be read as "expand call log menu for Jane Smith". + [CHAR LIMIT=NONE] + --> + <string name="a11y_new_call_log_entry_expand_menu"> + Expand call log menu for <xliff:g example="Jane Smith" id="primaryTextForEntry">%1$s</xliff:g> </string> <!-- Header in call log to group calls from the current day. [CHAR LIMIT=30] --> @@ -32,6 +41,7 @@ <!-- Header in call log to group calls from before yesterday. [CHAR LIMIT=30] --> <string name="new_call_log_header_older">Older</string> + <!-- Shown as a prompt to turn on the phone permission to enable the call log [CHAR LIMIT=NONE]--> <string name="new_call_log_permission_no_calllog">To see your call log, turn on the Phone permission.</string> diff --git a/java/com/android/dialer/calllog/ui/res/values/styles.xml b/java/com/android/dialer/calllog/ui/res/values/styles.xml index 047f1dace..3a02eb23f 100644 --- a/java/com/android/dialer/calllog/ui/res/values/styles.xml +++ b/java/com/android/dialer/calllog/ui/res/values/styles.xml @@ -16,32 +16,19 @@ --> <resources> - <style name="primary_textview"> - <item name="android:textColor">@color/primary_text_color</item> - <item name="android:fontFamily">sans-serif</item> - </style> + <style name="primary_textview" parent="Dialer.TextAppearance.Primary"/> - <style name="primary_textview_unread_call"> - <item name="android:textColor">@color/primary_text_color</item> - <item name="android:fontFamily">sans-serif-medium</item> - </style> + <style name="primary_textview_unread_call" parent="Dialer.TextAppearance.Header2"/> - <style name="secondary_textview"> - <item name="android:textColor">@color/secondary_text_color</item> - <item name="android:fontFamily">sans-serif</item> - </style> + <style name="secondary_textview" parent="Dialer.TextAppearance.Secondary"/> - <style name="phoneaccount_textview"> - <item name="android:fontFamily">sans-serif</item> - </style> + <style name="phoneaccount_textview"/> - <style name="secondary_textview_unread_call"> - <item name="android:textColor">@color/missed_call</item> - <item name="android:fontFamily">sans-serif-medium</item> + <style name="secondary_textview_unread_call" parent="Dialer.TextAppearance.Header2"> + <item name="android:textColor">@color/dialer_red</item> </style> <style name="phoneaccount_textview_unread_call"> <item name="android:fontFamily">sans-serif-medium</item> </style> - </resources>
\ No newline at end of file |