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

Commit 12b88801 authored by Katherine Kuan's avatar Katherine Kuan Committed by Android (Google) Code Review
Browse files

Merge "Auto select first group in group list on tablet"

parents a976f362 cab054c6
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -56,6 +56,15 @@ public class GroupBrowseListAdapter extends BaseAdapter {

    public void setCursor(Cursor cursor) {
        mCursor = cursor;

        // If there's no selected group already and the cursor is valid, then by default, select the
        // first group
        if (mSelectedGroupUri == null && cursor != null && cursor.getCount() > 0) {
            GroupListItem firstItem = getItem(0);
            long groupId = (firstItem == null) ? null : firstItem.getGroupId();
            mSelectedGroupUri = getGroupUriFromId(groupId);
        }

        notifyDataSetChanged();
    }

@@ -89,6 +98,10 @@ public class GroupBrowseListAdapter extends BaseAdapter {
        return mSelectedGroupUri != null && mSelectedGroupUri.equals(groupUri);
    }

    public Uri getSelectedGroup() {
        return mSelectedGroupUri;
    }

    @Override
    public int getCount() {
        return mCursor == null ? 0 : mCursor.getCount();
+1 −0
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ public class GroupBrowseListFragment extends Fragment
        }
        mListView.setEmptyView(mEmptyView);

        mSelectedGroupUri = mAdapter.getSelectedGroup();
        if (mSelectionVisible && mSelectedGroupUri != null) {
            viewGroup(mSelectedGroupUri);
        }