-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Icon downloaded and displayed for overflow Action #5809
[Android] Icon downloaded and displayed for overflow Action #5809
Conversation
rootLevelActions added to onDisplayMenuAction callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions
* @param view Overflow action view. | ||
* @param menuItemList list of view of rendered secondary action elements. | ||
* @param view Overflow action view. | ||
* @param isRootLevelActions indicates action is part of root level actions or action set elements in body. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param isRootLevelActions indicates action is part of root level actions or action set elements in body. | |
* @param isRootLevelActions true if action is defined at root level, false if part of ActionSet |
if (!iconUrl.isEmpty()) | ||
{ | ||
dropDownItem.post(() -> | ||
IconPlacement iconPlacement = hostConfig.GetActions().getIconPlacement(); | ||
if (!renderArgs.getAllowAboveTitleIconPlacement()) | ||
{ | ||
Drawable[] drawables = button.getCompoundDrawablesRelative(); | ||
dropDownItem.setCompoundDrawablePadding(button.getCompoundDrawablePadding()); | ||
dropDownItem.setCompoundDrawablesRelativeWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]); | ||
}); | ||
iconPlacement = IconPlacement.LeftOfTitle; | ||
} | ||
|
||
ActionElementRendererIconImageLoaderAsync imageLoader = new ActionElementRendererIconImageLoaderAsync( | ||
renderedCard, | ||
dropDownItem, | ||
hostConfig.GetImageBaseUrl(), | ||
iconPlacement, | ||
hostConfig.GetActions().getIconSize(), | ||
hostConfig.GetSpacing().getDefaultSpacing(), | ||
context | ||
); | ||
imageLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, iconUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is identical to code in ActionElementRenderer. Consider moving it into a helper within ActionElementRenderer and calling it, instead of duplicating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to helper class.
…t#5809) * Icon downloaded and displayed for DropdownItem. rootLevelActions added to onDisplayMenuAction callback. * Image loading functionality moved to helper class.
…t#5809) * Icon downloaded and displayed for DropdownItem. rootLevelActions added to onDisplayMenuAction callback. * Image loading functionality moved to helper class.
To display icon on a dropdown item, we usually fetch it from rendered action element and this works only when the dropdown item added to window. Otherwise, icon will not be displayed.
In this PR, we downloaded icon for dropdown item separately instead of fetching it from rendered action element, so the icon can be fetched and displayed on any condition.
Also, rootLevelActions flag added to the
onDisplayOverflowActionMenu()
callback to distinguish betweenAction & ActionSet
Microsoft Reviewers: Open in CodeFlow