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

Commit c1e769c1 authored by Yorke Lee's avatar Yorke Lee
Browse files

Fix PhoneFavoritesTileAdapter.getCount()

getCount() was reporting an incorrect length when the number of
entries is less than mColumnCount * mMaxTiledRows

Change-Id: I4504b200c938f4bf1a230fc4c2f1bf06ebc5128c
parent 01f15ad6
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -276,13 +276,16 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter {


    @Override
    @Override
    public int getCount() {
    public int getCount() {
        if (mContactEntries == null) {
        if (mContactEntries == null || mContactEntries.isEmpty()) {
            return 0;
            return 0;
        }
        }


        int total = mContactEntries.size();
        int total = mContactEntries.size();

        // The number of contacts that don't show up as tiles
        return total - (mMaxTiledRows * (mColumnCount - 1));
        final int nonTiledRows = Math.max(0, total - getMaxContactsInTiles());
        // The number of tiled rows
        final int tiledRows = getRowCount(total - nonTiledRows);
        return nonTiledRows + tiledRows;
    }
    }


    public int getMaxTiledRows() {
    public int getMaxTiledRows() {