diff options
author | 2024-04-25 15:59:55 +0000 | |
---|---|---|
committer | 2024-04-25 15:59:55 +0000 | |
commit | e962d14610e70b214e2b40159dfe588bccbbd4a3 (patch) | |
tree | f49babd6217483da01a612a5c424d9adf0f190e6 | |
parent | 012adf2aa6c9e7af231e1fdfbf898a2b28f25750 (diff) | |
parent | b67d4b095c88dc715b9bedde8f873af0f4ac04f3 (diff) |
Merge "Remove preview view from ChooserGridAdapter" into main
-rw-r--r-- | java/src/com/android/intentresolver/ChooserActivity.java | 17 | ||||
-rw-r--r-- | java/src/com/android/intentresolver/grid/ChooserGridAdapter.java | 41 |
2 files changed, 7 insertions, 51 deletions
diff --git a/java/src/com/android/intentresolver/ChooserActivity.java b/java/src/com/android/intentresolver/ChooserActivity.java index a9ca5d61..0d792b6d 100644 --- a/java/src/com/android/intentresolver/ChooserActivity.java +++ b/java/src/com/android/intentresolver/ChooserActivity.java @@ -611,9 +611,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements mRequest.getMetadataText(), mChooserServiceFeatureFlags.chooserPayloadToggling()); updateStickyContentPreview(); - if (shouldShowStickyContentPreview() - || mChooserMultiProfilePagerAdapter - .getCurrentRootAdapter().getSystemRowCount() != 0) { + if (shouldShowStickyContentPreview()) { getEventLog().logActionShareWithPreview( mChooserContentPreviewUi.getPreferredContentPreview()); } @@ -1993,16 +1991,6 @@ public class ChooserActivity extends Hilt_ChooserActivity implements context, new ChooserGridAdapter.ChooserActivityDelegate() { @Override - public boolean shouldShowTabs() { - return mProfiles.getWorkProfilePresent(); - } - - @Override - public View buildContentPreview(ViewGroup parent) { - return createContentPreviewView(parent); - } - - @Override public void onTargetSelected(int itemIndex) { startSelected(itemIndex, false, true); } @@ -2245,8 +2233,7 @@ public class ChooserActivity extends Hilt_ChooserActivity implements int top, int bottom, RecyclerView recyclerView, ChooserGridAdapter gridAdapter) { int offset = mSystemWindowInsets != null ? mSystemWindowInsets.bottom : 0; - int rowsToShow = gridAdapter.getSystemRowCount() - + gridAdapter.getServiceTargetRowCount() + int rowsToShow = gridAdapter.getServiceTargetRowCount() + gridAdapter.getCallerAndRankedTargetRowCount(); // then this is most likely not a SEND_* action, so check diff --git a/java/src/com/android/intentresolver/grid/ChooserGridAdapter.java b/java/src/com/android/intentresolver/grid/ChooserGridAdapter.java index cda69b9e..7cf9d2e9 100644 --- a/java/src/com/android/intentresolver/grid/ChooserGridAdapter.java +++ b/java/src/com/android/intentresolver/grid/ChooserGridAdapter.java @@ -66,15 +66,6 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView. * out of `ChooserGridAdapter` altogether. */ public interface ChooserActivityDelegate { - /** @return whether we're showing a tabbed (multi-profile) UI. */ - boolean shouldShowTabs(); - - /** - * @return a content preview {@link View} that's appropriate for the caller's share - * content, constructed for display in the provided {@code parent} group. - */ - View buildContentPreview(ViewGroup parent); - /** Notify the client that the item with the selected {@code itemIndex} was selected. */ void onTargetSelected(int itemIndex); @@ -87,7 +78,6 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView. private static final int VIEW_TYPE_DIRECT_SHARE = 0; private static final int VIEW_TYPE_NORMAL = 1; - private static final int VIEW_TYPE_CONTENT_PREVIEW = 2; private static final int VIEW_TYPE_AZ_LABEL = 4; private static final int VIEW_TYPE_CALLER_AND_RANK = 5; private static final int VIEW_TYPE_FOOTER = 6; @@ -195,8 +185,7 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView. public int getRowCount() { return (int) ( - getSystemRowCount() - + getServiceTargetRowCount() + getServiceTargetRowCount() + getCallerAndRankedTargetRowCount() + getAzLabelRowCount() + Math.ceil( @@ -205,14 +194,6 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView. ); } - /** - * Whether the "system" row of targets is displayed. - * This area includes the content preview (if present) and action row. - */ - public int getSystemRowCount() { - return 0; - } - public int getFooterRowCount() { return 1; } @@ -243,15 +224,13 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView. return -1; } - return getSystemRowCount() - + getServiceTargetRowCount() + return getServiceTargetRowCount() + getCallerAndRankedTargetRowCount(); } @Override public int getItemCount() { - return getSystemRowCount() - + getServiceTargetRowCount() + return getServiceTargetRowCount() + getCallerAndRankedTargetRowCount() + getAzLabelRowCount() + mChooserListAdapter.getAlphaTargetCount() @@ -262,12 +241,6 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView. @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { switch (viewType) { - case VIEW_TYPE_CONTENT_PREVIEW: - return new ItemViewHolder( - mChooserActivityDelegate.buildContentPreview(parent), - viewType, - null, - null); case VIEW_TYPE_AZ_LABEL: return new ItemViewHolder( createAzLabelView(parent), @@ -338,10 +311,8 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView. @Override public int getItemViewType(int position) { - int count; - - int countSum = (count = getSystemRowCount()); - if (count > 0 && position < countSum) return VIEW_TYPE_CONTENT_PREVIEW; + int count = 0; + int countSum = count; countSum += (count = getServiceTargetRowCount()); if (count > 0 && position < countSum) return VIEW_TYPE_DIRECT_SHARE; @@ -538,8 +509,6 @@ public final class ChooserGridAdapter extends RecyclerView.Adapter<RecyclerView. } int getListPosition(int position) { - position -= getSystemRowCount(); - final int serviceCount = mChooserListAdapter.getServiceTargetCount(); final int serviceRows = (int) Math.ceil((float) serviceCount / mMaxTargetsPerRow); if (position < serviceRows) { |