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

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

Change-Id: Iad038734da725934e0db63e8ab0109d9f6d9ad0c
This commit is contained in:
Antoan Angelov
2020-06-03 11:34:16 +00:00
committed by Automerger Merge Worker
2 changed files with 25 additions and 2 deletions

View File

@@ -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

View File

@@ -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;