Skip to content
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] Log warning if card element has a ShowCard select action #2717

Merged

Conversation

almedina-ms
Copy link
Contributor

Adds warning log for card elements having a select action with type ShowCard

@shalinijoshi19
Copy link
Member

General: Dont forget the "How Verified" section in the description :)

{
m_viewDictionary.put(elementId, foundView);
}
renderedCard.addWarning(new AdaptiveWarning(AdaptiveWarning.SELECT_SHOW_CARD_ACTION, "ShowCard not supported for SelectAction"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addWarning [](start = 29, length = 10)

Cool is this coming from teh sharedmodel now?

String elementId = target.GetElementId();

View foundView = rootView.findViewWithTag(new TagContent(elementId));
if (foundView != null)
Copy link
Member

@shalinijoshi19 shalinijoshi19 Apr 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you expect to not find the target element in the rootView object? What are the cases where this is null? Do we care about those cases ? (looks like today we dont since we'll silently not add them them to dictionary yeah? #ByDesign

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the card creator were to toggle the visibility of an element that doesn't exist (giving an id that doesn't exist for any element in the card) then the found view will be null and as such we can't change the visibility for that view


In reply to: 277106481 [](ancestors = 277106481)

}

v.setPressed(m_invisibleCard.getVisibility() != View.VISIBLE);
for (int i = 0; i < m_hiddenCardsLayout.getChildCount(); ++i)
Copy link
Member

@shalinijoshi19 shalinijoshi19 Apr 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++i [](start = 69, length = 3)

Nit: Consider using the more concise foreach equivalent syntax (i think for (View child : m_hiddenCardsLayout) ) ; #ByDesign

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Android API is weird in this kind of stuff so we have to get the elements one by one as it doesn't provide a "getChildren" method


In reply to: 277107266 [](ancestors = 277107266)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm you mean there is a requirement for being able to use the foreach java syntax for this collection?


In reply to: 278224177 [](ancestors = 278224177,277107266)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, to use the foreach syntax you must have the collection or be able to get the collection with a getter method that returns the complete collection, in this case, Android only allows us to grab one element at a time by querying each index

https://stackoverflow.com/questions/18668897/android-get-all-children-elements-of-a-viewgroup


In reply to: 278771455 [](ancestors = 278771455,278224177,277107266)

Copy link
Member

@shalinijoshi19 shalinijoshi19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@almedina-ms almedina-ms merged commit 88d915a into master Apr 27, 2019
@almedina-ms almedina-ms deleted the user/almedina-ms/AndroidAddWarningLogToSelectAcion branch May 2, 2019 22:03
rankush pushed a commit to rankush/AdaptiveCards that referenced this pull request May 8, 2024
…icrosoft#2717)

* Add warning for showcard action in select action

* Reverse the inheritance between SelectAction and regular action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants