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

Commit 4b705f50 authored by Antoan Angelov's avatar Antoan Angelov Committed by Android (Google) Code Review
Browse files

Merge "When calculating share sheet height, account for empty state screens." into rvc-dev

parents faf6a4d9 a30787b8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -452,7 +452,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter {
            mEmptyStateView = rootView.findViewById(R.id.resolver_empty_state);
        }

        private ViewGroup getEmptyStateView() {
        protected ViewGroup getEmptyStateView() {
            return mEmptyStateView;
        }
    }
+44 −30
Original line number Diff line number Diff line
@@ -2411,6 +2411,8 @@ public class ChooserActivity extends ResolverActivity implements
                mChooserMultiProfilePagerAdapter.getActiveAdapterView()
                        .setAdapter(mChooserMultiProfilePagerAdapter.getCurrentRootAdapter());
                return;
            } else if (mChooserMultiProfilePagerAdapter.getCurrentUserHandle() != getUser()) {
                return;
            }

            getMainThreadHandler().post(() -> {
@@ -2455,6 +2457,7 @@ public class ChooserActivity extends ResolverActivity implements
                    offset += tabDivider.getHeight();
                }

                if (recyclerView.getVisibility() == View.VISIBLE) {
                    int directShareHeight = 0;
                    rowsToShow = Math.min(4, rowsToShow);
                    mLastNumberOfChildren = recyclerView.getChildCount();
@@ -2489,12 +2492,23 @@ public class ChooserActivity extends ResolverActivity implements

                        offset = Math.min(offset, minHeight);
                    }
                } else {
                    ViewGroup currentEmptyStateView = getCurrentEmptyStateView();
                    if (currentEmptyStateView.getVisibility() == View.VISIBLE) {
                        offset += currentEmptyStateView.getHeight();
                    }
                }

                mResolverDrawerLayout.setCollapsibleHeightReserved(Math.min(offset, bottom - top));
            });
        }
    }

    private ViewGroup getCurrentEmptyStateView() {
        int currentPage = mChooserMultiProfilePagerAdapter.getCurrentPage();
        return mChooserMultiProfilePagerAdapter.getItem(currentPage).getEmptyStateView();
    }

    static class BaseChooserTargetComparator implements Comparator<ChooserTarget> {
        @Override
        public int compare(ChooserTarget lhs, ChooserTarget rhs) {