Loading core/java/com/android/internal/app/ChooserActivity.java +21 −24 Original line number Diff line number Diff line Loading @@ -171,9 +171,6 @@ public class ChooserActivity extends ResolverActivity implements private AppPredictor mWorkAppPredictor; private boolean mShouldDisplayLandscape; private static final int MAX_TARGETS_PER_ROW_PORTRAIT = 4; private static final int MAX_TARGETS_PER_ROW_LANDSCAPE = 8; @UnsupportedAppUsage public ChooserActivity() { } Loading Loading @@ -294,6 +291,7 @@ public class ChooserActivity extends ResolverActivity implements private int mCurrAvailableWidth = 0; private int mLastNumberOfChildren = -1; private int mMaxTargetsPerRow = 1; private static final String TARGET_DETAILS_FRAGMENT_TAG = "targetDetailsFragment"; Loading Loading @@ -681,8 +679,9 @@ public class ChooserActivity extends ResolverActivity implements mCallerChooserTargets = targets; } mShouldDisplayLandscape = shouldDisplayLandscape( getResources().getConfiguration().orientation); mMaxTargetsPerRow = getResources().getInteger(R.integer.config_chooser_max_targets_per_row); mShouldDisplayLandscape = shouldDisplayLandscape(getResources().getConfiguration().orientation); setRetainInOnStop(intent.getBooleanExtra(EXTRA_PRIVATE_RETAIN_IN_ON_STOP, false)); super.onCreate(savedInstanceState, target, title, defaultTitleRes, initialIntents, null, false); Loading Loading @@ -915,7 +914,7 @@ public class ChooserActivity extends ResolverActivity implements adapter, getPersonalProfileUserHandle(), /* workProfileUserHandle= */ null, isSendAction(getTargetIntent()), getMaxTargetsPerRow()); isSendAction(getTargetIntent()), mMaxTargetsPerRow); } private ChooserMultiProfilePagerAdapter createChooserMultiProfilePagerAdapterForTwoProfiles( Loading Loading @@ -944,7 +943,7 @@ public class ChooserActivity extends ResolverActivity implements selectedProfile, getPersonalProfileUserHandle(), getWorkProfileUserHandle(), isSendAction(getTargetIntent()), getMaxTargetsPerRow()); isSendAction(getTargetIntent()), mMaxTargetsPerRow); } private int findSelectedProfile() { Loading Loading @@ -1112,6 +1111,7 @@ public class ChooserActivity extends ResolverActivity implements } mShouldDisplayLandscape = shouldDisplayLandscape(newConfig.orientation); mMaxTargetsPerRow = getResources().getInteger(R.integer.config_chooser_max_targets_per_row); adjustPreviewWidth(newConfig.orientation, null); updateStickyContentPreview(); } Loading Loading @@ -2560,7 +2560,7 @@ public class ChooserActivity extends ResolverActivity implements // and b/150936654 recyclerView.setAdapter(gridAdapter); ((GridLayoutManager) recyclerView.getLayoutManager()).setSpanCount( getMaxTargetsPerRow()); mMaxTargetsPerRow); } UserHandle currentUserHandle = mChooserMultiProfilePagerAdapter.getCurrentUserHandle(); Loading Loading @@ -2724,7 +2724,7 @@ public class ChooserActivity extends ResolverActivity implements @Override // ChooserListCommunicator public int getMaxRankedTargets() { return getMaxTargetsPerRow(); return mMaxTargetsPerRow; } @Override // ChooserListCommunicator Loading Loading @@ -3075,13 +3075,6 @@ public class ChooserActivity extends ResolverActivity implements } } int getMaxTargetsPerRow() { int maxTargets = MAX_TARGETS_PER_ROW_PORTRAIT; if (mShouldDisplayLandscape) { maxTargets = MAX_TARGETS_PER_ROW_LANDSCAPE; } return maxTargets; } /** * 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 Loading Loading @@ -3149,7 +3142,11 @@ public class ChooserActivity extends ResolverActivity implements return false; } int newWidth = width / getMaxTargetsPerRow(); // Limit width to the maximum width of the chooser activity int maxWidth = getResources().getDimensionPixelSize(R.dimen.chooser_width); width = Math.min(maxWidth, width); int newWidth = width / mMaxTargetsPerRow; if (newWidth != mChooserTargetWidth) { mChooserTargetWidth = newWidth; return true; Loading Loading @@ -3184,7 +3181,7 @@ public class ChooserActivity extends ResolverActivity implements + getAzLabelRowCount() + Math.ceil( (float) mChooserListAdapter.getAlphaTargetCount() / getMaxTargetsPerRow()) / mMaxTargetsPerRow) ); } Loading Loading @@ -3224,7 +3221,7 @@ public class ChooserActivity extends ResolverActivity implements public int getCallerAndRankedTargetRowCount() { return (int) Math.ceil( ((float) mChooserListAdapter.getCallerTargetCount() + mChooserListAdapter.getRankedTargetCount()) / getMaxTargetsPerRow()); + mChooserListAdapter.getRankedTargetCount()) / mMaxTargetsPerRow); } // There can be at most one row in the listview, that is internally Loading Loading @@ -3423,7 +3420,7 @@ public class ChooserActivity extends ResolverActivity implements parentGroup.addView(row2); mDirectShareViewHolder = new DirectShareViewHolder(parentGroup, Lists.newArrayList(row1, row2), getMaxTargetsPerRow(), viewType, Lists.newArrayList(row1, row2), mMaxTargetsPerRow, viewType, mChooserMultiProfilePagerAdapter::getActiveListAdapter); loadViewsIntoGroup(mDirectShareViewHolder); Loading @@ -3432,7 +3429,7 @@ public class ChooserActivity extends ResolverActivity implements ViewGroup row = (ViewGroup) mLayoutInflater.inflate(R.layout.chooser_row, parent, false); ItemGroupViewHolder holder = new SingleRowViewHolder(row, getMaxTargetsPerRow(), viewType); new SingleRowViewHolder(row, mMaxTargetsPerRow, viewType); loadViewsIntoGroup(holder); return holder; Loading Loading @@ -3524,7 +3521,7 @@ public class ChooserActivity extends ResolverActivity implements final int serviceCount = mChooserListAdapter.getServiceTargetCount(); final int serviceRows = (int) Math.ceil((float) serviceCount / getMaxRankedTargets()); if (position < serviceRows) { return position * getMaxTargetsPerRow(); return position * mMaxTargetsPerRow; } position -= serviceRows; Loading @@ -3533,7 +3530,7 @@ public class ChooserActivity extends ResolverActivity implements + mChooserListAdapter.getRankedTargetCount(); final int callerAndRankedRows = getCallerAndRankedTargetRowCount(); if (position < callerAndRankedRows) { return serviceCount + position * getMaxTargetsPerRow(); return serviceCount + position * mMaxTargetsPerRow; } position -= getAzLabelRowCount() + callerAndRankedRows; Loading @@ -3546,7 +3543,7 @@ public class ChooserActivity extends ResolverActivity implements if (mDirectShareViewHolder != null && canExpandDirectShare) { mDirectShareViewHolder.handleScroll( mChooserMultiProfilePagerAdapter.getActiveAdapterView(), y, oldy, getMaxTargetsPerRow()); mMaxTargetsPerRow); } } Loading core/res/res/layout/chooser_grid.xml +2 −0 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:maxCollapsedHeight="0dp" android:maxCollapsedHeightSmall="56dp" android:maxWidth="@dimen/chooser_width" android:id="@id/contentPanel"> <RelativeLayout Loading core/res/res/layout/chooser_grid_preview_image.xml +2 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView" android:id="@+id/content_preview_image_1_large" android:layout_width="120dp" android:layout_height="140dp" android:layout_height="104dp" android:layout_alignParentTop="true" android:adjustViewBounds="true" android:gravity="center" Loading @@ -44,7 +44,7 @@ android:id="@+id/content_preview_image_2_large" android:visibility="gone" android:layout_width="120dp" android:layout_height="140dp" android:layout_height="104dp" android:layout_alignParentTop="true" android:layout_toRightOf="@id/content_preview_image_1_large" android:layout_marginLeft="10dp" Loading core/res/res/values-sw600dp/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -51,5 +51,7 @@ <!-- If true, show multiuser switcher by default unless the user specifically disables it. --> <bool name="config_showUserSwitcherByDefault">true</bool> <integer name="config_chooser_max_targets_per_row">6</integer> </resources> core/res/res/values-sw600dp/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -110,4 +110,7 @@ <dimen name="immersive_mode_cling_width">380dp</dimen> <dimen name="floating_toolbar_preferred_width">544dp</dimen> <dimen name="chooser_width">624dp</dimen> </resources> Loading
core/java/com/android/internal/app/ChooserActivity.java +21 −24 Original line number Diff line number Diff line Loading @@ -171,9 +171,6 @@ public class ChooserActivity extends ResolverActivity implements private AppPredictor mWorkAppPredictor; private boolean mShouldDisplayLandscape; private static final int MAX_TARGETS_PER_ROW_PORTRAIT = 4; private static final int MAX_TARGETS_PER_ROW_LANDSCAPE = 8; @UnsupportedAppUsage public ChooserActivity() { } Loading Loading @@ -294,6 +291,7 @@ public class ChooserActivity extends ResolverActivity implements private int mCurrAvailableWidth = 0; private int mLastNumberOfChildren = -1; private int mMaxTargetsPerRow = 1; private static final String TARGET_DETAILS_FRAGMENT_TAG = "targetDetailsFragment"; Loading Loading @@ -681,8 +679,9 @@ public class ChooserActivity extends ResolverActivity implements mCallerChooserTargets = targets; } mShouldDisplayLandscape = shouldDisplayLandscape( getResources().getConfiguration().orientation); mMaxTargetsPerRow = getResources().getInteger(R.integer.config_chooser_max_targets_per_row); mShouldDisplayLandscape = shouldDisplayLandscape(getResources().getConfiguration().orientation); setRetainInOnStop(intent.getBooleanExtra(EXTRA_PRIVATE_RETAIN_IN_ON_STOP, false)); super.onCreate(savedInstanceState, target, title, defaultTitleRes, initialIntents, null, false); Loading Loading @@ -915,7 +914,7 @@ public class ChooserActivity extends ResolverActivity implements adapter, getPersonalProfileUserHandle(), /* workProfileUserHandle= */ null, isSendAction(getTargetIntent()), getMaxTargetsPerRow()); isSendAction(getTargetIntent()), mMaxTargetsPerRow); } private ChooserMultiProfilePagerAdapter createChooserMultiProfilePagerAdapterForTwoProfiles( Loading Loading @@ -944,7 +943,7 @@ public class ChooserActivity extends ResolverActivity implements selectedProfile, getPersonalProfileUserHandle(), getWorkProfileUserHandle(), isSendAction(getTargetIntent()), getMaxTargetsPerRow()); isSendAction(getTargetIntent()), mMaxTargetsPerRow); } private int findSelectedProfile() { Loading Loading @@ -1112,6 +1111,7 @@ public class ChooserActivity extends ResolverActivity implements } mShouldDisplayLandscape = shouldDisplayLandscape(newConfig.orientation); mMaxTargetsPerRow = getResources().getInteger(R.integer.config_chooser_max_targets_per_row); adjustPreviewWidth(newConfig.orientation, null); updateStickyContentPreview(); } Loading Loading @@ -2560,7 +2560,7 @@ public class ChooserActivity extends ResolverActivity implements // and b/150936654 recyclerView.setAdapter(gridAdapter); ((GridLayoutManager) recyclerView.getLayoutManager()).setSpanCount( getMaxTargetsPerRow()); mMaxTargetsPerRow); } UserHandle currentUserHandle = mChooserMultiProfilePagerAdapter.getCurrentUserHandle(); Loading Loading @@ -2724,7 +2724,7 @@ public class ChooserActivity extends ResolverActivity implements @Override // ChooserListCommunicator public int getMaxRankedTargets() { return getMaxTargetsPerRow(); return mMaxTargetsPerRow; } @Override // ChooserListCommunicator Loading Loading @@ -3075,13 +3075,6 @@ public class ChooserActivity extends ResolverActivity implements } } int getMaxTargetsPerRow() { int maxTargets = MAX_TARGETS_PER_ROW_PORTRAIT; if (mShouldDisplayLandscape) { maxTargets = MAX_TARGETS_PER_ROW_LANDSCAPE; } return maxTargets; } /** * 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 Loading Loading @@ -3149,7 +3142,11 @@ public class ChooserActivity extends ResolverActivity implements return false; } int newWidth = width / getMaxTargetsPerRow(); // Limit width to the maximum width of the chooser activity int maxWidth = getResources().getDimensionPixelSize(R.dimen.chooser_width); width = Math.min(maxWidth, width); int newWidth = width / mMaxTargetsPerRow; if (newWidth != mChooserTargetWidth) { mChooserTargetWidth = newWidth; return true; Loading Loading @@ -3184,7 +3181,7 @@ public class ChooserActivity extends ResolverActivity implements + getAzLabelRowCount() + Math.ceil( (float) mChooserListAdapter.getAlphaTargetCount() / getMaxTargetsPerRow()) / mMaxTargetsPerRow) ); } Loading Loading @@ -3224,7 +3221,7 @@ public class ChooserActivity extends ResolverActivity implements public int getCallerAndRankedTargetRowCount() { return (int) Math.ceil( ((float) mChooserListAdapter.getCallerTargetCount() + mChooserListAdapter.getRankedTargetCount()) / getMaxTargetsPerRow()); + mChooserListAdapter.getRankedTargetCount()) / mMaxTargetsPerRow); } // There can be at most one row in the listview, that is internally Loading Loading @@ -3423,7 +3420,7 @@ public class ChooserActivity extends ResolverActivity implements parentGroup.addView(row2); mDirectShareViewHolder = new DirectShareViewHolder(parentGroup, Lists.newArrayList(row1, row2), getMaxTargetsPerRow(), viewType, Lists.newArrayList(row1, row2), mMaxTargetsPerRow, viewType, mChooserMultiProfilePagerAdapter::getActiveListAdapter); loadViewsIntoGroup(mDirectShareViewHolder); Loading @@ -3432,7 +3429,7 @@ public class ChooserActivity extends ResolverActivity implements ViewGroup row = (ViewGroup) mLayoutInflater.inflate(R.layout.chooser_row, parent, false); ItemGroupViewHolder holder = new SingleRowViewHolder(row, getMaxTargetsPerRow(), viewType); new SingleRowViewHolder(row, mMaxTargetsPerRow, viewType); loadViewsIntoGroup(holder); return holder; Loading Loading @@ -3524,7 +3521,7 @@ public class ChooserActivity extends ResolverActivity implements final int serviceCount = mChooserListAdapter.getServiceTargetCount(); final int serviceRows = (int) Math.ceil((float) serviceCount / getMaxRankedTargets()); if (position < serviceRows) { return position * getMaxTargetsPerRow(); return position * mMaxTargetsPerRow; } position -= serviceRows; Loading @@ -3533,7 +3530,7 @@ public class ChooserActivity extends ResolverActivity implements + mChooserListAdapter.getRankedTargetCount(); final int callerAndRankedRows = getCallerAndRankedTargetRowCount(); if (position < callerAndRankedRows) { return serviceCount + position * getMaxTargetsPerRow(); return serviceCount + position * mMaxTargetsPerRow; } position -= getAzLabelRowCount() + callerAndRankedRows; Loading @@ -3546,7 +3543,7 @@ public class ChooserActivity extends ResolverActivity implements if (mDirectShareViewHolder != null && canExpandDirectShare) { mDirectShareViewHolder.handleScroll( mChooserMultiProfilePagerAdapter.getActiveAdapterView(), y, oldy, getMaxTargetsPerRow()); mMaxTargetsPerRow); } } Loading
core/res/res/layout/chooser_grid.xml +2 −0 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:maxCollapsedHeight="0dp" android:maxCollapsedHeightSmall="56dp" android:maxWidth="@dimen/chooser_width" android:id="@id/contentPanel"> <RelativeLayout Loading
core/res/res/layout/chooser_grid_preview_image.xml +2 −2 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ <view class="com.android.internal.app.ChooserActivity$RoundedRectImageView" android:id="@+id/content_preview_image_1_large" android:layout_width="120dp" android:layout_height="140dp" android:layout_height="104dp" android:layout_alignParentTop="true" android:adjustViewBounds="true" android:gravity="center" Loading @@ -44,7 +44,7 @@ android:id="@+id/content_preview_image_2_large" android:visibility="gone" android:layout_width="120dp" android:layout_height="140dp" android:layout_height="104dp" android:layout_alignParentTop="true" android:layout_toRightOf="@id/content_preview_image_1_large" android:layout_marginLeft="10dp" Loading
core/res/res/values-sw600dp/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -51,5 +51,7 @@ <!-- If true, show multiuser switcher by default unless the user specifically disables it. --> <bool name="config_showUserSwitcherByDefault">true</bool> <integer name="config_chooser_max_targets_per_row">6</integer> </resources>
core/res/res/values-sw600dp/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -110,4 +110,7 @@ <dimen name="immersive_mode_cling_width">380dp</dimen> <dimen name="floating_toolbar_preferred_width">544dp</dimen> <dimen name="chooser_width">624dp</dimen> </resources>