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

Commit a9c8e505 authored by Matt Pietal's avatar Matt Pietal
Browse files

Sharesheet - 4->8 direct share expansion fix

The 4->8 expansion area can become stuck when the user is scrolling as
the list is rebuilt, say from a package changed event. Be more
specific about when we choose to lock this area.

Bug: 129979914
Test: Constantly scroll while sharesheet is loading
Change-Id: I969d628e1e420fd12133cef413dadf4f14ca75d7
parent db54f27d
Loading
Loading
Loading
Loading
+19 −10
Original line number Diff line number Diff line
@@ -2536,8 +2536,8 @@ public class ChooserActivity extends ResolverActivity {

            if (isDirectShare) {
                DirectShareViewHolder dsvh = (DirectShareViewHolder) holder;
                setViewHeight(dsvh.getRow(0), holder.getMeasuredRowHeight());
                setViewHeight(dsvh.getRow(1), holder.getMeasuredRowHeight());
                setViewHeight(dsvh.getRow(0), dsvh.getMinRowHeight());
                setViewHeight(dsvh.getRow(1), dsvh.getMinRowHeight());
            }

            viewGroup.setTag(holder);
@@ -2825,6 +2825,10 @@ public class ChooserActivity extends ResolverActivity {
            return mDirectShareCurrHeight;
        }

        public int getMinRowHeight() {
            return mDirectShareMinHeight;
        }

        public void setViewVisibility(int i, int visibility) {
            final View v = getView(i);
            if (visibility == View.VISIBLE) {
@@ -2847,6 +2851,10 @@ public class ChooserActivity extends ResolverActivity {
        }

        public void handleScroll(AbsListView view, int y, int oldy, int maxTargetsPerRow) {
            // only exit early if fully collapsed, otherwise onListRebuilt() with shifting
            // targets can lock us into an expanded mode
            boolean notExpanded = mDirectShareCurrHeight == mDirectShareMinHeight;
            if (notExpanded) {
                if (mHideDirectShareExpansion) {
                    return;
                }
@@ -2857,6 +2865,7 @@ public class ChooserActivity extends ResolverActivity {
                    mHideDirectShareExpansion = true;
                    return;
                }
            }

            int yDiff = (int) ((oldy - y) * DIRECT_SHARE_EXPANSION_RATE);