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

Add single mode #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ buildscript {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-rc01'
classpath 'com.android.tools.build:gradle:3.5.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public boolean apply(Object obj) {

private List<Section> sections;

private Boolean singleMode;

private ExpandCollapseListener.ExpandListener expandListener;

private ExpandCollapseListener.CollapseListener collapseListener;
Expand Down Expand Up @@ -86,6 +88,7 @@ private void init(Context context, AttributeSet attributeSet) {
typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.ExpandableLayout);
parentLayout = typedArray.getResourceId(R.styleable.ExpandableLayout_parentLayout, NO_RES);
childLayout = typedArray.getResourceId(R.styleable.ExpandableLayout_childLayout, NO_RES);
singleMode = typedArray.getBoolean(R.styleable.ExpandableLayout_singleMode, false);
layoutInflater = LayoutInflater.from(context);
} finally {
if (typedArray != null) {
Expand Down Expand Up @@ -257,8 +260,8 @@ private <P> void expand(@NonNull P parent) {
sections.get(i).expanded = true;
if (expandListener != null)
expandListener.onExpanded(i, sections.get(i).parent, sectionView.getChildAt(0));
break;
}
}else if (singleMode)
collapse(sections.get(i).parent);
}
}

Expand Down
1 change: 1 addition & 0 deletions expandablelib/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<declare-styleable name="ExpandableLayout">
<attr name="parentLayout" format="integer" />
<attr name="childLayout" format="integer" />
<attr name="singleMode" format="boolean" />
</declare-styleable>

</resources>
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Aug 23 14:26:53 CDT 2018
#Thu Sep 05 15:20:37 EET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-rc-1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip