Merge "Add bottom offset to empty state screens for chooser" into rvc-dev am: 3b31c14eb5 am: f03fafc76a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11623666 Change-Id: I2a15c5d7cea5c00c8556cd72b8db4bf9867d1808
This commit is contained in:
@@ -102,6 +102,7 @@ import android.view.View.OnClickListener;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
|
import android.view.WindowInsets;
|
||||||
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.view.animation.DecelerateInterpolator;
|
import android.view.animation.DecelerateInterpolator;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@@ -2680,7 +2681,7 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
offset = Math.min(offset, minHeight);
|
offset = Math.min(offset, minHeight);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ViewGroup currentEmptyStateView = getCurrentEmptyStateView();
|
ViewGroup currentEmptyStateView = getActiveEmptyStateView();
|
||||||
if (currentEmptyStateView.getVisibility() == View.VISIBLE) {
|
if (currentEmptyStateView.getVisibility() == View.VISIBLE) {
|
||||||
offset += currentEmptyStateView.getHeight();
|
offset += currentEmptyStateView.getHeight();
|
||||||
}
|
}
|
||||||
@@ -2705,7 +2706,7 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ViewGroup getCurrentEmptyStateView() {
|
private ViewGroup getActiveEmptyStateView() {
|
||||||
int currentPage = mChooserMultiProfilePagerAdapter.getCurrentPage();
|
int currentPage = mChooserMultiProfilePagerAdapter.getCurrentPage();
|
||||||
return mChooserMultiProfilePagerAdapter.getItem(currentPage).getEmptyStateView();
|
return mChooserMultiProfilePagerAdapter.getItem(currentPage).getEmptyStateView();
|
||||||
}
|
}
|
||||||
@@ -3030,6 +3031,17 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
intent.fixUris(UserHandle.myUserId());
|
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.
|
* 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
|
* Note that ranked sections like Direct Share - while appearing grid-like - are handled on the
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public class ChooserMultiProfilePagerAdapter extends AbstractMultiProfilePagerAd
|
|||||||
|
|
||||||
private final ChooserProfileDescriptor[] mItems;
|
private final ChooserProfileDescriptor[] mItems;
|
||||||
private final boolean mIsSendAction;
|
private final boolean mIsSendAction;
|
||||||
|
private int mBottomOffset;
|
||||||
|
|
||||||
ChooserMultiProfilePagerAdapter(Context context,
|
ChooserMultiProfilePagerAdapter(Context context,
|
||||||
ChooserActivity.ChooserGridAdapter adapter,
|
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 {
|
class ChooserProfileDescriptor extends ProfileDescriptor {
|
||||||
private ChooserActivity.ChooserGridAdapter chooserGridAdapter;
|
private ChooserActivity.ChooserGridAdapter chooserGridAdapter;
|
||||||
private RecyclerView recyclerView;
|
private RecyclerView recyclerView;
|
||||||
|
|||||||
Reference in New Issue
Block a user