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

Commit 241a19c5 authored by Flavio Lerda's avatar Flavio Lerda Committed by Android (Google) Code Review
Browse files

Merge "Improve accessibility of call log's call button."

parents 66a27e41 7ecd4db7
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -1676,13 +1676,6 @@
    <!--  Used to display as default status when the contact is busy or Do not disturb for chat [CHAR LIMIT=19] -->
    <string name="status_busy">Busy</string>

    <!-- String describing the icon in the call log used to place a call.

        Note: AccessibilityServices use this attribute to announce what the view represents.
              This is especially valuable for views without textual representation like ImageView.
    -->
    <string name="description_call_log_call_button">Call number</string>

    <!-- String describing the icon in the call log used to play a voicemail.

        Note: AccessibilityServices use this attribute to announce what the view represents.
+17 −4
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import com.android.contacts.R;

import android.content.res.Resources;
import android.provider.CallLog.Calls;
import android.text.TextUtils;
import android.view.View;

/**
@@ -68,7 +69,7 @@ import android.view.View;
            views.dividerView.setVisibility(View.VISIBLE);
        } else if (canCall) {
            // Call is the secondary action.
            configureCallSecondaryAction(views);
            configureCallSecondaryAction(views, details);
            views.dividerView.setVisibility(View.VISIBLE);
        } else {
            // No action available.
@@ -78,11 +79,23 @@ import android.view.View;
    }

    /** Sets the secondary action to correspond to the call button. */
    private void configureCallSecondaryAction(CallLogListItemViews views) {
    private void configureCallSecondaryAction(CallLogListItemViews views,
            PhoneCallDetails details) {
        views.secondaryActionView.setVisibility(View.VISIBLE);
        views.secondaryActionView.setImageResource(R.drawable.ic_ab_dialer_holo_dark);
        views.secondaryActionView.setContentDescription(
                mResources.getString(R.string.description_call_log_call_button));
        views.secondaryActionView.setContentDescription(getCallActionDescription(details));
    }

    /** Returns the description used by the call action for this phone call. */
    private CharSequence getCallActionDescription(PhoneCallDetails details) {
        final CharSequence recipient;
        if (!TextUtils.isEmpty(details.name)) {
            recipient = details.name;
        } else {
            recipient = mPhoneNumberHelper.getDisplayNumber(
                    details.number, details.formattedNumber);
        }
        return mResources.getString(R.string.description_call, recipient);
    }

    /** Sets the secondary action to correspond to the play button. */