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

Commit 2b0d2982 authored by John Shao's avatar John Shao
Browse files

Cleanup GroupMembers classes

Remove redundant calls and fix some cursor stuff.

Bug: 29160869
Bug: 30287073
Change-Id: Ib38dde331480f9e02eae55ad5f1ba9b9ea55cf0b
parent 5de24579
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.ContactsContract.RawContacts;
import android.support.v4.view.GravityCompat;
import android.support.v7.app.ActionBar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
+2 −10
Original line number Diff line number Diff line
@@ -73,8 +73,8 @@ public class GroupMembersAdapter extends MultiSelectEntryContactListAdapter {

    public GroupMembersAdapter(Context context) {
        super(context, GroupMembersQuery.CONTACT_ID);

        mUnknownNameText = context.getText(R.string.missing_name);
        setSectionHeaderDisplayEnabled(true);
    }

    /** Sets the ID of the group whose members will be displayed. */
@@ -83,7 +83,7 @@ public class GroupMembersAdapter extends MultiSelectEntryContactListAdapter {
    }

    /** Returns the lookup Uri for the contact at the given position in the underlying cursor. */
    public Uri getContactLookupUri(int position) {
    public Uri getContactUri(int position) {
        final Cursor cursor = (Cursor) getItem(position);
        final long contactId = cursor.getLong(GroupMembersQuery.CONTACT_ID);
        final String lookupKey = cursor.getString(GroupMembersQuery.CONTACT_LOOKUP_KEY);
@@ -135,13 +135,6 @@ public class GroupMembersAdapter extends MultiSelectEntryContactListAdapter {
        return ((Cursor) getItem(position)).getString(GroupMembersQuery.CONTACT_DISPLAY_NAME);
    }

    public Uri getContactUri(int position) {
        final Cursor cursor = (Cursor) getItem(position);
        final long contactId = cursor.getLong(GroupMembersQuery.CONTACT_ID);
        final String lookupKey = cursor.getString(GroupMembersQuery.CONTACT_LOOKUP_KEY);
        return Contacts.getLookupUri(contactId, lookupKey);
    }

    @Override
    protected ContactListItemView newView(Context context, int partition, Cursor cursor,
            int position, ViewGroup parent) {
@@ -155,7 +148,6 @@ public class GroupMembersAdapter extends MultiSelectEntryContactListAdapter {
    protected void bindView(View v, int partition, Cursor cursor, int position) {
        super.bindView(v, partition, cursor, position);
        final ContactListItemView view = (ContactListItemView) v;
        bindViewId(view, cursor, GroupMembersQuery.CONTACT_ID);
        bindSectionHeaderAndDivider(view, position);
        bindName(view, cursor);
        bindPhoto(view, cursor);
+10 −5
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ package com.android.contacts.group;

import android.app.Activity;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.Context;
import android.content.CursorLoader;
import android.content.Loader;
import android.content.res.Configuration;
@@ -162,8 +161,15 @@ public class GroupMembersFragment extends MultiSelectContactsListFragment<GroupM

        @Override
        public boolean moveToPosition(int position) {
            if (position >= mCount || position < 0) return false;
            return super.moveToPosition(mIndex[position]);
            if (position >= mCount) {
                mPos = mCount;
                return false;
            } else if (position < 0) {
                mPos = -1;
                return false;
            }
            mPos = mIndex[position];
            return super.moveToPosition(mPos);
        }

        @Override
@@ -397,8 +403,7 @@ public class GroupMembersFragment extends MultiSelectContactsListFragment<GroupM
            return;
        }
        if (mListener != null) {
            final Uri contactLookupUri = getAdapter().getContactLookupUri(position);
            mListener.onGroupMemberListItemClicked(position, contactLookupUri);
            mListener.onGroupMemberListItemClicked(position, uri);
        }
    }

+9 −2
Original line number Diff line number Diff line
@@ -148,8 +148,15 @@ public class GroupMemberPickerFragment extends

        @Override
        public boolean moveToPosition(int position) {
            if (position >= mCount || position < 0) return false;
            return super.moveToPosition(mIndex[position]);
            if (position >= mCount) {
                mPos = mCount;
                return false;
            } else if (position < 0) {
                mPos = -1;
                return false;
            }
            mPos = mIndex[position];
            return super.moveToPosition(mPos);
        }

        @Override