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

Commit f880f3dc authored by Wenyi Wang's avatar Wenyi Wang Committed by Android (Google) Code Review
Browse files

Merge "Enable Talkback for long clicking contacts" into ub-contactsdialer-a-dev

parents 09fe43f7 eeae8877
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.view.accessibility.AccessibilityEvent;

import java.util.TreeSet;

@@ -125,6 +126,16 @@ public class MultiSelectContactsListFragment extends DefaultContactBrowseListFra
                    mCheckBoxListListener.onStartDisplayingCheckBoxes();
                }
                getAdapter().toggleSelectionOfContactId(Long.valueOf(contactId));
                // Sending an accessibility event of TYPE_VIEW_CLICKED and forcing Talkback to be
                // performed on the checkbox.
                // We need to:
                // 1. consider the difference between position and adjPosition;
                // 2. make sure the list item is not null before sending the event.
                final int adjPosition = position + getListView().getHeaderViewsCount();
                if (getListView() != null && adjPosition < getListView().getChildCount()) {
                    getListView().getChildAt(adjPosition).sendAccessibilityEvent(AccessibilityEvent
                            .TYPE_VIEW_CLICKED);
                }
            }
        }
        final int nowSelectedCount = getAdapter().getSelectedContactIds().size();