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

Commit dc073567 authored by Michael Kwan's avatar Michael Kwan Committed by Android (Google) Code Review
Browse files

Merge "Hide space for title if the title is GONE." into cw-f-dev

parents ab2c2441 790a34e1
Loading
Loading
Loading
Loading
+11 −30
Original line number Diff line number Diff line
@@ -103,7 +103,8 @@ public class WatchHeaderListView extends ListView {

    @Override
    public int getHeaderViewsCount() {
        return mTopPanel == null ? super.getHeaderViewsCount() : super.getHeaderViewsCount() + 1;
        return mTopPanel == null ? super.getHeaderViewsCount()
                : super.getHeaderViewsCount() + (mTopPanel.getVisibility() == GONE ? 0 : 1);
    }

    private void wrapAdapterIfNecessary() {
@@ -133,7 +134,7 @@ public class WatchHeaderListView extends ListView {
        }

        private int getTopPanelCount() {
            return mTopPanel == null ? 0 : 1;
            return (mTopPanel == null || mTopPanel.getVisibility() == GONE) ? 0 : 1;
        }

        @Override
@@ -143,33 +144,19 @@ public class WatchHeaderListView extends ListView {

        @Override
        public boolean areAllItemsEnabled() {
            return mTopPanel == null && super.areAllItemsEnabled();
            return getTopPanelCount() == 0 && super.areAllItemsEnabled();
        }

        @Override
        public boolean isEnabled(int position) {
            if (mTopPanel != null) {
                if (position == 0) {
                    return false;
                } else {
                    return super.isEnabled(position - 1);
                }
            }

            return super.isEnabled(position);
            int topPanelCount = getTopPanelCount();
            return position < topPanelCount ? false : super.isEnabled(position - topPanelCount);
        }

        @Override
        public Object getItem(int position) {
            if (mTopPanel != null) {
                if (position == 0) {
                    return null;
                } else {
                    return super.getItem(position - 1);
                }
            }

            return super.getItem(position);
            int topPanelCount = getTopPanelCount();
            return position < topPanelCount ? null : super.getItem(position - topPanelCount);
        }

        @Override
@@ -187,15 +174,9 @@ public class WatchHeaderListView extends ListView {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            if (mTopPanel != null) {
                if (position == 0) {
                    return mTopPanel;
                } else {
                    return super.getView(position - 1, convertView, parent);
                }
            }

            return super.getView(position, convertView, parent);
            int topPanelCount = getTopPanelCount();
            return position < topPanelCount
                    ? mTopPanel : super.getView(position - topPanelCount, convertView, parent);
        }

        @Override