Loading core/java/com/android/internal/app/ChooserActivity.java +14 −16 Original line number Diff line number Diff line Loading @@ -274,8 +274,6 @@ public class ChooserActivity extends ResolverActivity implements private int mLastNumberOfChildren = -1; private static final String TARGET_DETAILS_FRAGMENT_TAG = "targetDetailsFragment"; // TODO: Update to handle landscape instead of using static value private static final int MAX_RANKED_TARGETS = 4; private final List<ChooserTargetServiceConnection> mServiceConnections = new ArrayList<>(); private final Set<Pair<ComponentName, UserHandle>> mServicesRequested = new HashSet<>(); Loading Loading @@ -952,7 +950,7 @@ public class ChooserActivity extends ResolverActivity implements updateStickyContentPreview(); if (shouldShowStickyContentPreview() || mChooserMultiProfilePagerAdapter .getCurrentRootAdapter().getContentPreviewRowCount() != 0) { .getCurrentRootAdapter().getSystemRowCount() != 0) { logActionShareWithPreview(); } return postRebuildListInternal(rebuildCompleted); Loading Loading @@ -1326,13 +1324,14 @@ public class ChooserActivity extends ResolverActivity implements ViewGroup parent) { ViewGroup contentPreviewLayout = (ViewGroup) layoutInflater.inflate( R.layout.chooser_grid_preview_image, parent, false); ViewGroup imagePreview = contentPreviewLayout.findViewById(R.id.content_preview_image_area); final ViewGroup actionRow = (ViewGroup) contentPreviewLayout.findViewById(R.id.chooser_action_row); //TODO: addActionButton(actionRow, createCopyButton()); addActionButton(actionRow, createNearbyButton(targetIntent)); mPreviewCoord = new ContentPreviewCoordinator(contentPreviewLayout, true); mPreviewCoord = new ContentPreviewCoordinator(contentPreviewLayout, false); String action = targetIntent.getAction(); if (Intent.ACTION_SEND.equals(action)) { Loading @@ -1352,7 +1351,7 @@ public class ChooserActivity extends ResolverActivity implements if (imageUris.size() == 0) { Log.i(TAG, "Attempted to display image preview area with zero" + " available images detected in EXTRA_STREAM list"); contentPreviewLayout.setVisibility(View.GONE); imagePreview.setVisibility(View.GONE); return contentPreviewLayout; } Loading Loading @@ -2695,7 +2694,7 @@ public class ChooserActivity extends ResolverActivity implements final int bottomInset = mSystemWindowInsets != null ? mSystemWindowInsets.bottom : 0; int offset = bottomInset; int rowsToShow = gridAdapter.getContentPreviewRowCount() int rowsToShow = gridAdapter.getSystemRowCount() + gridAdapter.getProfileRowCount() + gridAdapter.getServiceTargetRowCount() + gridAdapter.getCallerAndRankedTargetRowCount(); Loading Loading @@ -3295,7 +3294,7 @@ public class ChooserActivity extends ResolverActivity implements public int getRowCount() { return (int) ( getContentPreviewRowCount() getSystemRowCount() + getProfileRowCount() + getServiceTargetRowCount() + getCallerAndRankedTargetRowCount() Loading @@ -3307,22 +3306,21 @@ public class ChooserActivity extends ResolverActivity implements } /** * Returns either {@code 0} or {@code 1} depending on whether we want to show the list item * content preview. Not to be confused with the sticky content preview which is above the * personal and work tabs. * Whether the "system" row of targets is displayed. * This area includes the content preview (if present) and action row. */ public int getContentPreviewRowCount() { public int getSystemRowCount() { // For the tabbed case we show the sticky content preview above the tabs, // please refer to shouldShowStickyContentPreview if (shouldShowTabs()) { return 0; } if (!isSendAction(getTargetIntent())) { return 0; } if (mHideContentPreview || mChooserListAdapter == null || mChooserListAdapter.getCount() == 0) { if (mChooserListAdapter == null || mChooserListAdapter.getCount() == 0) { return 0; } Loading Loading @@ -3364,7 +3362,7 @@ public class ChooserActivity extends ResolverActivity implements @Override public int getItemCount() { return (int) ( getContentPreviewRowCount() getSystemRowCount() + getProfileRowCount() + getServiceTargetRowCount() + getCallerAndRankedTargetRowCount() Loading Loading @@ -3419,7 +3417,7 @@ public class ChooserActivity extends ResolverActivity implements public int getItemViewType(int position) { int count; int countSum = (count = getContentPreviewRowCount()); int countSum = (count = getSystemRowCount()); if (count > 0 && position < countSum) return VIEW_TYPE_CONTENT_PREVIEW; countSum += (count = getProfileRowCount()); Loading Loading @@ -3643,7 +3641,7 @@ public class ChooserActivity extends ResolverActivity implements } int getListPosition(int position) { position -= getContentPreviewRowCount() + getProfileRowCount(); position -= getSystemRowCount() + getProfileRowCount(); final int serviceCount = mChooserListAdapter.getServiceTargetCount(); final int serviceRows = (int) Math.ceil((float) serviceCount Loading Loading
core/java/com/android/internal/app/ChooserActivity.java +14 −16 Original line number Diff line number Diff line Loading @@ -274,8 +274,6 @@ public class ChooserActivity extends ResolverActivity implements private int mLastNumberOfChildren = -1; private static final String TARGET_DETAILS_FRAGMENT_TAG = "targetDetailsFragment"; // TODO: Update to handle landscape instead of using static value private static final int MAX_RANKED_TARGETS = 4; private final List<ChooserTargetServiceConnection> mServiceConnections = new ArrayList<>(); private final Set<Pair<ComponentName, UserHandle>> mServicesRequested = new HashSet<>(); Loading Loading @@ -952,7 +950,7 @@ public class ChooserActivity extends ResolverActivity implements updateStickyContentPreview(); if (shouldShowStickyContentPreview() || mChooserMultiProfilePagerAdapter .getCurrentRootAdapter().getContentPreviewRowCount() != 0) { .getCurrentRootAdapter().getSystemRowCount() != 0) { logActionShareWithPreview(); } return postRebuildListInternal(rebuildCompleted); Loading Loading @@ -1326,13 +1324,14 @@ public class ChooserActivity extends ResolverActivity implements ViewGroup parent) { ViewGroup contentPreviewLayout = (ViewGroup) layoutInflater.inflate( R.layout.chooser_grid_preview_image, parent, false); ViewGroup imagePreview = contentPreviewLayout.findViewById(R.id.content_preview_image_area); final ViewGroup actionRow = (ViewGroup) contentPreviewLayout.findViewById(R.id.chooser_action_row); //TODO: addActionButton(actionRow, createCopyButton()); addActionButton(actionRow, createNearbyButton(targetIntent)); mPreviewCoord = new ContentPreviewCoordinator(contentPreviewLayout, true); mPreviewCoord = new ContentPreviewCoordinator(contentPreviewLayout, false); String action = targetIntent.getAction(); if (Intent.ACTION_SEND.equals(action)) { Loading @@ -1352,7 +1351,7 @@ public class ChooserActivity extends ResolverActivity implements if (imageUris.size() == 0) { Log.i(TAG, "Attempted to display image preview area with zero" + " available images detected in EXTRA_STREAM list"); contentPreviewLayout.setVisibility(View.GONE); imagePreview.setVisibility(View.GONE); return contentPreviewLayout; } Loading Loading @@ -2695,7 +2694,7 @@ public class ChooserActivity extends ResolverActivity implements final int bottomInset = mSystemWindowInsets != null ? mSystemWindowInsets.bottom : 0; int offset = bottomInset; int rowsToShow = gridAdapter.getContentPreviewRowCount() int rowsToShow = gridAdapter.getSystemRowCount() + gridAdapter.getProfileRowCount() + gridAdapter.getServiceTargetRowCount() + gridAdapter.getCallerAndRankedTargetRowCount(); Loading Loading @@ -3295,7 +3294,7 @@ public class ChooserActivity extends ResolverActivity implements public int getRowCount() { return (int) ( getContentPreviewRowCount() getSystemRowCount() + getProfileRowCount() + getServiceTargetRowCount() + getCallerAndRankedTargetRowCount() Loading @@ -3307,22 +3306,21 @@ public class ChooserActivity extends ResolverActivity implements } /** * Returns either {@code 0} or {@code 1} depending on whether we want to show the list item * content preview. Not to be confused with the sticky content preview which is above the * personal and work tabs. * Whether the "system" row of targets is displayed. * This area includes the content preview (if present) and action row. */ public int getContentPreviewRowCount() { public int getSystemRowCount() { // For the tabbed case we show the sticky content preview above the tabs, // please refer to shouldShowStickyContentPreview if (shouldShowTabs()) { return 0; } if (!isSendAction(getTargetIntent())) { return 0; } if (mHideContentPreview || mChooserListAdapter == null || mChooserListAdapter.getCount() == 0) { if (mChooserListAdapter == null || mChooserListAdapter.getCount() == 0) { return 0; } Loading Loading @@ -3364,7 +3362,7 @@ public class ChooserActivity extends ResolverActivity implements @Override public int getItemCount() { return (int) ( getContentPreviewRowCount() getSystemRowCount() + getProfileRowCount() + getServiceTargetRowCount() + getCallerAndRankedTargetRowCount() Loading Loading @@ -3419,7 +3417,7 @@ public class ChooserActivity extends ResolverActivity implements public int getItemViewType(int position) { int count; int countSum = (count = getContentPreviewRowCount()); int countSum = (count = getSystemRowCount()); if (count > 0 && position < countSum) return VIEW_TYPE_CONTENT_PREVIEW; countSum += (count = getProfileRowCount()); Loading Loading @@ -3643,7 +3641,7 @@ public class ChooserActivity extends ResolverActivity implements } int getListPosition(int position) { position -= getContentPreviewRowCount() + getProfileRowCount(); position -= getSystemRowCount() + getProfileRowCount(); final int serviceCount = mChooserListAdapter.getServiceTargetCount(); final int serviceRows = (int) Math.ceil((float) serviceCount Loading