Skip to content

Commit

Permalink
Use one-based widget index for MaterialCollapsible activeIndex.
Browse files Browse the repository at this point in the history
  • Loading branch information
BenDol committed May 23, 2016
1 parent d55fe14 commit b8613f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,15 @@ public boolean isAccordion() {
}

/**
* Providing a zero-based index to activate a child {@link MaterialCollapsibleItem}.
* Providing the one-based index of the
* {@link MaterialCollapsibleItem} to mark as active.
*/
public void setActive(int index) {
clearActive();
activeIndex = index;
if(isAttached()) {
if(index < getWidgetCount()) {
activeWidget = getWidget(index);
activeWidget = getWidget(index - 1);
if (activeWidget != null && activeWidget instanceof MaterialCollapsibleItem) {
((MaterialCollapsibleItem) activeWidget).setActive(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down

0 comments on commit b8613f6

Please sign in to comment.