diff options
| author | 2023-04-25 20:58:14 +0000 | |
|---|---|---|
| committer | 2023-04-25 20:58:14 +0000 | |
| commit | f59a68d4feb4f3c1665d111db03759e6b970c5ae (patch) | |
| tree | 4cde8ad0b41147a7e67dcef1daa192feb393404f /java/src/com | |
| parent | df944c13e379fe924a5556fc749350270586fb8e (diff) | |
Hide one of the divider lines if there are no actions.
Otherwise the top and bottom merge into one thicker line.
Bug: 274810036
Test: Visual inspection.
Change-Id: I8fe09fdd438ccdacde808d06ae8f0e65e73a6146
Diffstat (limited to 'java/src/com')
3 files changed, 21 insertions, 8 deletions
diff --git a/java/src/com/android/intentresolver/contentpreview/FileContentPreviewUi.java b/java/src/com/android/intentresolver/contentpreview/FileContentPreviewUi.java index e43ab6d3..85f94451 100644 --- a/java/src/com/android/intentresolver/contentpreview/FileContentPreviewUi.java +++ b/java/src/com/android/intentresolver/contentpreview/FileContentPreviewUi.java @@ -96,8 +96,12 @@ class FileContentPreviewUi extends ContentPreviewUi { final ActionRow actionRow = contentPreviewLayout.findViewById(com.android.internal.R.id.chooser_action_row); - actionRow.setActions( - createActions(new ArrayList<>(), mActionFactory.createCustomActions())); + List<ActionRow.Action> actions = + createActions(new ArrayList<>(), mActionFactory.createCustomActions()); + actionRow.setActions(actions); + if (actions.isEmpty()) { + contentPreviewLayout.findViewById(R.id.actions_top_divider).setVisibility(View.GONE); + } return contentPreviewLayout; } diff --git a/java/src/com/android/intentresolver/contentpreview/FilesPlusTextContentPreviewUi.java b/java/src/com/android/intentresolver/contentpreview/FilesPlusTextContentPreviewUi.java index 12843e0a..d6da4a49 100644 --- a/java/src/com/android/intentresolver/contentpreview/FilesPlusTextContentPreviewUi.java +++ b/java/src/com/android/intentresolver/contentpreview/FilesPlusTextContentPreviewUi.java @@ -98,9 +98,14 @@ class FilesPlusTextContentPreviewUi extends ContentPreviewUi { final ActionRow actionRow = contentPreviewLayout.findViewById(com.android.internal.R.id.chooser_action_row); - actionRow.setActions(createActions( + List<ActionRow.Action> actions = createActions( createImagePreviewActions(), - mActionFactory.createCustomActions())); + mActionFactory.createCustomActions()); + actionRow.setActions(actions); + + if (actions.isEmpty()) { + contentPreviewLayout.findViewById(R.id.actions_top_divider).setVisibility(View.GONE); + } if (shouldShowPreview()) { mImageLoader.loadImage(mFiles.get(0).getPreviewUri(), bitmap -> { diff --git a/java/src/com/android/intentresolver/contentpreview/UnifiedContentPreviewUi.java b/java/src/com/android/intentresolver/contentpreview/UnifiedContentPreviewUi.java index 8d3e6031..d8e2088b 100644 --- a/java/src/com/android/intentresolver/contentpreview/UnifiedContentPreviewUi.java +++ b/java/src/com/android/intentresolver/contentpreview/UnifiedContentPreviewUi.java @@ -85,10 +85,14 @@ class UnifiedContentPreviewUi extends ContentPreviewUi { final ActionRow actionRow = contentPreviewLayout.findViewById(com.android.internal.R.id.chooser_action_row); - actionRow.setActions( - createActions( - createImagePreviewActions(), - mActionFactory.createCustomActions())); + List<ActionRow.Action> actions = createActions( + createImagePreviewActions(), + mActionFactory.createCustomActions()); + actionRow.setActions(actions); + if (actions.isEmpty()) { + contentPreviewLayout.findViewById(R.id.actions_top_divider).setVisibility(View.GONE); + } + if (mFiles.size() == 0) { Log.i( |