diff options
| author | 2020-03-19 12:59:42 +0000 | |
|---|---|---|
| committer | 2020-03-19 12:59:42 +0000 | |
| commit | bfdf19c46d7da3bd5f10c7db91c7703bf7e466e3 (patch) | |
| tree | e1d880f5d17da1f0a85592e4f4fbaca5638b463b | |
| parent | a895040b486508461ab4355eb5e0032c5837f74a (diff) | |
| parent | 2731fa71fe68b862f476eac6c93f9503c695706b (diff) | |
Merge "Call setAdapter from handleLayoutChanged." into rvc-dev
| -rw-r--r-- | core/java/com/android/internal/app/ChooserActivity.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index 78a0ae0907ff..a1a434d3bc64 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -2418,13 +2418,20 @@ public class ChooserActivity extends ResolverActivity implements if (isLayoutUpdated || mLastNumberOfChildren != recyclerView.getChildCount()) { mCurrAvailableWidth = availableWidth; - if (isLayoutUpdated - && mChooserMultiProfilePagerAdapter.getCurrentUserHandle() != getUser()) { - // This fixes b/150936654 - empty work tab in share sheet when swiping - mChooserMultiProfilePagerAdapter.getActiveAdapterView() - .setAdapter(mChooserMultiProfilePagerAdapter.getCurrentRootAdapter()); + if (isLayoutUpdated) { + // It is very important we call setAdapter from here. Otherwise in some cases + // the resolver list doesn't get populated, such as b/150922090, b/150918223 + // and b/150936654 + recyclerView.setAdapter(gridAdapter); + ((GridLayoutManager) recyclerView.getLayoutManager()).setSpanCount( + gridAdapter.getMaxTargetsPerRow()); + } + + if (mChooserMultiProfilePagerAdapter.getCurrentUserHandle() != getUser()) { return; - } else if (mChooserMultiProfilePagerAdapter.getCurrentUserHandle() != getUser()) { + } + + if (mLastNumberOfChildren == recyclerView.getChildCount()) { return; } |