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

Commit 43cf576a authored by John Shao's avatar John Shao
Browse files

Add stable IDs to multiselect view for talkback

GroupMemberAdapter was not reading _ID column so view ID
was different from Adapter.getItemId. Provide the appropriate
overrides so those IDs stay consistent and talkback doesn't
get confused when views are refreshed.

Bug: 29160869
Bug: 30287073
Change-Id: I87719b0b9f8eede57c036b829dc06f8e52857e97
parent 34ab8e03
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -145,10 +145,20 @@ public abstract class MultiSelectEntryContactListAdapter extends ContactEntryLis
        }
    }

    @Override
    public long getItemId(int position) {
        Cursor cursor = (Cursor) getItem(position);
        if (cursor != null) {
            return cursor.getLong(getContactColumnIdIndex());
        }
        return 0;
     }

    @Override
    protected void bindView(View itemView, int partition, Cursor cursor, int position) {
        super.bindView(itemView, partition, cursor, position);
        final ContactListItemView view = (ContactListItemView) itemView;
        bindViewId(view, cursor, getContactColumnIdIndex());
        bindCheckBox(view, cursor, position, partition == ContactsContract.Directory.DEFAULT);
    }