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

Fix Button spacing issues and add horizontal scroll view in case actions orientation is horizontal . #1452

Merged
merged 7 commits into from
May 17, 2018

Conversation

rednivrug15
Copy link
Contributor

@rednivrug15 rednivrug15 commented May 13, 2018

  1. Fix spacing between two buttons . It should follow the hostConfig property for spacing between two buttons #1432

  2. Fix the spacing between the buttons layout and the last card element . This should also follow the host config property #1432

  3. Add horizontal scroll view to make buttons scrollable in case they exceed the width available #1426.

  4. Fix a bug in multiple choice input where title is returned instead of returning the value when Action.Submit button is pressed #1449.

  5. Fix fact set rendering issue where the content is clipped #1472

@msftclas
Copy link

msftclas commented May 13, 2018

CLA assistant check
All CLA requirements met.

@@ -255,6 +260,15 @@ else if (alignment == ActionAlignment.Center.swigValue())
ActionElementRenderer.getInstance().render(renderedCard, context, fragmentManager, actionButtonsLayout, actionElement, cardActionHandler, hostConfig);
}

if (viewGroup != null && hostConfig.getActions().getActionsOrientation().swigValue() == ActionsOrientation.Horizontal.swigValue())
{
Copy link

Choose a reason for hiding this comment

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

We are adding actionbuttonslayout above and then removing it from view group. Can you change the code above to selectively add to scroll view if required and avoid the add and removal

Copy link
Contributor

Choose a reason for hiding this comment

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

@rednivrug15 I agree with this comment, can you change it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@almedina-ms currently the show card action has a very tight binding to the view hierarchy . It expects the parent's parent ( view.getParent().getParent() ) to be top level card . We will have to change the show card layout's implementation if we do not want to do it this way .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@almedina-ms Since the horizontal scroll has been implemented I will revert the change for horizontal scroll and keep rest of the bug fixes here . Can you please look into this ?

return (String) getSpinner().getSelectedItem();
int index = getSpinner().getSelectedItemPosition();
String selectedItem = "";
if (index >= 0)
Copy link

Choose a reason for hiding this comment

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

nit: check index < getchoices().length just to be super safe?

String selectedItem = "";
if (index >= 0)
{
selectedItem = choiceSetInput.GetChoices().get(index).GetValue();
Copy link

@msmoosa msmoosa May 13, 2018

Choose a reason for hiding this comment

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

Nit: Simply return here.. why store?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer having one single return point in this case, after all it's just one extra line of code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed as the SDK prefers single point of return .

@@ -242,6 +244,9 @@ else if (alignment == ActionAlignment.Center.swigValue())
actionButtonsLayout.setOrientation(LinearLayout.HORIZONTAL);
}

Spacing spacing = hostConfig.getActions().getSpacing();
BaseCardElementRenderer.setSpacingAndSeparator(context, viewGroup, spacing, false, hostConfig, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment next to the false and true values to know what do they stand for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Will add the same comment as has been used elsewhere .

@khouzam khouzam merged commit e2067bf into microsoft:master May 17, 2018
khouzam pushed a commit that referenced this pull request May 18, 2018
…ons orientation is horizontal . (#1452)

* fix button spacing bugs and add horizontal scroll view to buttons

* fix blank line

* add scrollview only if actions alignment is horizontal

* add comments

* added check to see if selected item is within range

* improve fact set renderer

* remove unnecessary changes
khouzam pushed a commit that referenced this pull request May 21, 2018
…ons orientation is horizontal . (#1452)

* fix button spacing bugs and add horizontal scroll view to buttons

* fix blank line

* add scrollview only if actions alignment is horizontal

* add comments

* added check to see if selected item is within range

* improve fact set renderer

* remove unnecessary changes
rankush pushed a commit to rankush/AdaptiveCards that referenced this pull request May 8, 2024
…ons orientation is horizontal . (microsoft#1452)

* fix button spacing bugs and add horizontal scroll view to buttons

* fix blank line

* add scrollview only if actions alignment is horizontal

* add comments

* added check to see if selected item is within range

* improve fact set renderer

* remove unnecessary changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants