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

Commit d9b47e05 authored by Antoan Angelov's avatar Antoan Angelov Committed by Automerger Merge Worker
Browse files

Merge "Add bottom offset to empty state screens for chooser" into rvc-dev am:...

Merge "Add bottom offset to empty state screens for chooser" into rvc-dev am: 3b31c14e am: f03fafc7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11623666

Change-Id: I1a6ae40dd12f24f1eefc3456088b2eefe8c8e36c
parents 4a5aafcc f03fafc7
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver;
import android.view.WindowInsets;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.Button;
@@ -2680,7 +2681,7 @@ public class ChooserActivity extends ResolverActivity implements
                        offset = Math.min(offset, minHeight);
                    }
                } else {
                    ViewGroup currentEmptyStateView = getCurrentEmptyStateView();
                    ViewGroup currentEmptyStateView = getActiveEmptyStateView();
                    if (currentEmptyStateView.getVisibility() == View.VISIBLE) {
                        offset += currentEmptyStateView.getHeight();
                    }
@@ -2705,7 +2706,7 @@ public class ChooserActivity extends ResolverActivity implements
        return -1;
    }

    private ViewGroup getCurrentEmptyStateView() {
    private ViewGroup getActiveEmptyStateView() {
        int currentPage = mChooserMultiProfilePagerAdapter.getCurrentPage();
        return mChooserMultiProfilePagerAdapter.getItem(currentPage).getEmptyStateView();
    }
@@ -3030,6 +3031,17 @@ public class ChooserActivity extends ResolverActivity implements
        intent.fixUris(UserHandle.myUserId());
    }

    @Override
    protected WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
        if (shouldShowTabs()) {
            mChooserMultiProfilePagerAdapter
                    .setEmptyStateBottomOffset(insets.getSystemWindowInsetBottom());
            mChooserMultiProfilePagerAdapter.setupContainerPadding(
                    getActiveEmptyStateView().findViewById(R.id.resolver_empty_state_container));
        }
        return super.onApplyWindowInsets(v, insets);
    }

    /**
     * Adapter for all types of items and targets in ShareSheet.
     * Note that ranked sections like Direct Share - while appearing grid-like - are handled on the
+11 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public class ChooserMultiProfilePagerAdapter extends AbstractMultiProfilePagerAd

    private final ChooserProfileDescriptor[] mItems;
    private final boolean mIsSendAction;
    private int mBottomOffset;

    ChooserMultiProfilePagerAdapter(Context context,
            ChooserActivity.ChooserGridAdapter adapter,
@@ -245,6 +246,16 @@ public class ChooserMultiProfilePagerAdapter extends AbstractMultiProfilePagerAd
        }
    }

    void setEmptyStateBottomOffset(int bottomOffset) {
        mBottomOffset = bottomOffset;
    }

    @Override
    protected void setupContainerPadding(View container) {
        container.setPadding(container.getPaddingLeft(), container.getPaddingTop(),
                container.getPaddingRight(), container.getPaddingBottom() + mBottomOffset);
    }

    class ChooserProfileDescriptor extends ProfileDescriptor {
        private ChooserActivity.ChooserGridAdapter chooserGridAdapter;
        private RecyclerView recyclerView;