-
Notifications
You must be signed in to change notification settings - Fork 550
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] Fix Toggle visibility to dissappear separation #2742
[Android] Fix Toggle visibility to dissappear separation #2742
Conversation
…ssapperSeparation
|
||
if (tag != null && tag instanceof TagContent) | ||
{ | ||
TagContent tagContent = (TagContent)tag; |
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 know it's kind of small, but it might be nice to have a little helper function that takes a View
and gives you its TagContent
. Feel free to say no or add it in a future checkin. :) #Resolved
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.
Could you add a link to the issue tracking this? Also, do we have separate bugs tracking bleed changes based on toggle? #Resolved |
I added the link but the issues track both changes (bleed & separator) In reply to: 486355510 [](ancestors = 486355510) |
…ssapperSeparation
@@ -110,13 +113,52 @@ private void populateViewsDictionary() | |||
String elementId = target.GetElementId(); | |||
|
|||
View foundView = rootView.findViewWithTag(new TagContent(elementId)); | |||
if(foundView != null) | |||
if (foundView != null) |
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.
if ( [](start = 15, length = 5)
Is this clang-formatted?
private void resetSeparatorVisibilities(ViewGroup viewGroup) | ||
{ | ||
boolean isFirstElement = true; | ||
for (int i = 0; i < viewGroup.getChildCount(); ++i) |
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.
Nit: consider using the more compact foreach syntax
|
||
if (tagContent != null) | ||
{ | ||
if (!tagContent.IsSeparator() && element.getVisibility() == View.VISIBLE) |
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.
element.getVisibility() == View.VISIBLE [](start = 53, length = 39)
Nit: enclose in inner () for readability
// If the visibility changes to not visible or the visibility toggles and the element is currently visible then the element will not be visible | ||
// Otherwise it will be visible (default value) | ||
if ((isVisible == IsVisible.IsVisibleFalse) || | ||
(isVisible == IsVisible.IsVisibleToggle && foundView.getVisibility() == View.VISIBLE)) |
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.
ibleToggle & [](start = 57, length = 12)
nit: is this clang-formatted?
@@ -140,28 +185,24 @@ public void onClick(View v) | |||
View foundView = m_viewDictionary.get(elementId); | |||
IsVisible isVisible = target.GetIsVisible(); |
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.
IsVisible [](start = 24, length = 9)
we need a custom IsVisible type? why doesnt boolean suffice again?
lots of magic numbers interspersed in the code base; Let;s make sure we address this eventually say in some Constants class or something Refers to: source/android/adaptivecards/src/main/java/io/adaptivecards/renderer/BaseCardElementRenderer.java:91 in 567593e. [](commit_id = 567593e, deletion_comment = False) |
@@ -70,7 +73,7 @@ protected static void setSpacingAndSeparator(Context context, | |||
if (viewGroup.getChildCount() <= 0) | |||
{ | |||
//Do not add space to the first element of a viewgroup | |||
return; | |||
return null; | |||
} | |||
int spacingSize = Util.dpToPixels(context, getSpacingSize(spacing, hostConfig.GetSpacing())); | |||
int separatorThickness = Util.dpToPixels(context, hostConfig.GetSeparator().getLineThickness()); |
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.
Nit: Function naming - generally prefer verb (convertDpToPixels or something)
{ | ||
if (minHeight != 0) | ||
{ | ||
view.setMinimumHeight(Util.dpToPixels(context, (int)minHeight)); |
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.
int)minHeigh [](start = 60, length = 12)
why the need for different units and hence casting? (long vs int)
@@ -63,7 +63,9 @@ public static ChoiceSetInputRenderer getInstance() | |||
public View renderCheckBoxSet( | |||
RenderedAdaptiveCard renderedCard, | |||
Context context, | |||
ChoiceSetInput choiceSetInput) | |||
ChoiceSetInput choiceSetInput, |
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.
Nit: Inconsistent formatting of function parameters in teh source code (eg baseacationelementrenderer.java vs this file) . Is it an old school windows style each parameter on a new line? What is the clang formatting rules set to?
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.
Do we have separate bugs for other platforms for this issue? |
…ssapperSeparation
…ssapperSeparation
…tion' of https://github.com/Microsoft/AdaptiveCards into user/almedina-ms/AndroidToggleVisibilityDissapperSeparation
…ssapperSeparation
…ssapperSeparation
…ssapperSeparation
Adds extra data to the TagContent object to be able to hide the separators whenever the element is hidden (or show them when the element re appears)
Also fixes the case where ther first element is deleted and the second element has to hide its separator (and all related cases)
Fix for this: #2605
How verified
The mobile app was run and this are the results
Case 1
Top element disappears and second element should hide its separator
When the image is hidden, the textblock separator hides
When the image reappears, the textblock separator also reappears
Case 2
First column in columnset disappears, so the second column must hide its separator
When the first column disappears, the column separator hides
When the first column is shown, so does the column 2 separator