├── expanding-view ├── README.md ├── .gitignore ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ │ ├── drawable │ │ │ │ └── expanding_item_circle_base.xml │ │ │ ├── values │ │ │ │ └── attrs.xml │ │ │ └── layout │ │ │ │ └── expanding_item_base_layout.xml │ │ └── java │ │ │ ├── utils │ │ │ └── CustomViewUtils.java │ │ │ └── com │ │ │ └── diegodobelo │ │ │ └── expandingview │ │ │ ├── ExpandingList.java │ │ │ └── ExpandingItem.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── diegodobelo │ │ │ └── expandingview │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── diegodobelo │ │ └── expandingview │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── example ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── font │ │ │ │ ├── muli_light.ttf │ │ │ │ ├── muli_regular.ttf │ │ │ │ └── muli.xml │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_explore.png │ │ │ │ ├── ic_ghost.png │ │ │ │ └── ic_action_add.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_explore.png │ │ │ │ ├── ic_ghost.png │ │ │ │ └── ic_action_add.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_ghost.png │ │ │ │ ├── ic_explore.png │ │ │ │ └── ic_action_add.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_ghost.png │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_explore.png │ │ │ │ └── ic_action_add.png │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── ic_delete.png │ │ │ │ ├── ic_ghost.png │ │ │ │ ├── ic_explore.png │ │ │ │ └── ic_action_add.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── atts.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ ├── separator_layout.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── expanding_layout.xml │ │ │ │ ├── expanding_sub_item.xml │ │ │ │ └── expanding_item.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── diegodobelo │ │ │ └── expandinganimlib │ │ │ └── MainActivity.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── diegodobelo │ │ │ └── expandinganimlib │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── diegodobelo │ │ └── expandinganimlib │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── doc ├── package-list ├── resources │ ├── tab.gif │ ├── titlebar.gif │ ├── background.gif │ └── titlebar_end.gif ├── allclasses-noframe.html ├── allclasses-frame.html ├── com │ └── diegodobelo │ │ └── expandingview │ │ ├── package-frame.html │ │ ├── package-tree.html │ │ ├── package-summary.html │ │ ├── ExpandingItem.OnItemStateChanged.html │ │ └── ExpandingItem.html ├── index.html ├── deprecated-list.html ├── constant-values.html ├── overview-tree.html ├── help-doc.html ├── stylesheet.css └── index-all.html ├── settings.gradle ├── art └── shoping_list.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew └── README.md /expanding-view/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /expanding-view/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /doc/package-list: -------------------------------------------------------------------------------- 1 | com.diegodobelo.expandingview 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':example', ':expanding-view' 2 | -------------------------------------------------------------------------------- /art/shoping_list.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/art/shoping_list.gif -------------------------------------------------------------------------------- /doc/resources/tab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/doc/resources/tab.gif -------------------------------------------------------------------------------- /doc/resources/titlebar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/doc/resources/titlebar.gif -------------------------------------------------------------------------------- /doc/resources/background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/doc/resources/background.gif -------------------------------------------------------------------------------- /doc/resources/titlebar_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/doc/resources/titlebar_end.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/src/main/res/font/muli_light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/font/muli_light.ttf -------------------------------------------------------------------------------- /example/src/main/res/font/muli_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/font/muli_regular.ttf -------------------------------------------------------------------------------- /example/src/main/res/drawable-hdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-hdpi/ic_delete.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-hdpi/ic_explore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-hdpi/ic_explore.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-hdpi/ic_ghost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-hdpi/ic_ghost.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-mdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-mdpi/ic_delete.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-mdpi/ic_explore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-mdpi/ic_explore.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-mdpi/ic_ghost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-mdpi/ic_ghost.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xhdpi/ic_delete.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xhdpi/ic_ghost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xhdpi/ic_ghost.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xxhdpi/ic_ghost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xxhdpi/ic_ghost.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xhdpi/ic_explore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xhdpi/ic_explore.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xxhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xxhdpi/ic_delete.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xxhdpi/ic_explore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xxhdpi/ic_explore.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xxxhdpi/ic_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xxxhdpi/ic_delete.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xxxhdpi/ic_ghost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xxxhdpi/ic_ghost.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-hdpi/ic_action_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-hdpi/ic_action_add.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-mdpi/ic_action_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-mdpi/ic_action_add.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xhdpi/ic_action_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xhdpi/ic_action_add.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xxhdpi/ic_action_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xxhdpi/ic_action_add.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xxxhdpi/ic_explore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xxxhdpi/ic_explore.png -------------------------------------------------------------------------------- /example/src/main/res/drawable-xxxhdpi/ic_action_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diegodobelo/AndroidExpandingViewLibrary/HEAD/example/src/main/res/drawable-xxxhdpi/ic_action_add.png -------------------------------------------------------------------------------- /example/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ExpandingAnimLib 3 | Enter Title 4 | 5 | -------------------------------------------------------------------------------- /example/src/main/res/values/atts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-rc-1-all.zip 7 | -------------------------------------------------------------------------------- /expanding-view/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/src/main/res/font/muli.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 10 | -------------------------------------------------------------------------------- /example/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /example/src/test/java/com/diegodobelo/expandinganimlib/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.diegodobelo.expandinganimlib; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /expanding-view/src/test/java/com/diegodobelo/expandingview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.diegodobelo.expandingview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /example/src/androidTest/java/com/diegodobelo/expandinganimlib/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.diegodobelo.expandinganimlib; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /expanding-view/src/androidTest/java/com/diegodobelo/expandingview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.diegodobelo.expandingview; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /example/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #1C1038 4 | #303F9F 5 | #FF4081 6 | 7 | #241445 8 | #18102C 9 | 10 | #FF308E 11 | #FA9301 12 | #F8D411 13 | #20CBF3 14 | #6F26FA 15 | #49CC56 16 | #FFFFFF 17 | 18 | 19 | -------------------------------------------------------------------------------- /example/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /example/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/diego/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /expanding-view/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/diego/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /example/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | build/* 3 | */app.iml 4 | app/src/test/* 5 | app/src/AndroidTest/* 6 | app/build/* 7 | app/schemas/* 8 | 9 | # Crashlytics configuations 10 | com_crashlytics_export_strings.xml 11 | 12 | # Local configuration file (sdk path, etc) 13 | local.properties 14 | 15 | # Gradle generated files 16 | .gradle/ 17 | 18 | # Signing files 19 | .signing/ 20 | 21 | # User-specific configurations 22 | .idea/* 23 | .idea/libraries/ 24 | .idea/workspace.xml 25 | .idea/tasks.xml 26 | .idea/.name 27 | .idea/compiler.xml 28 | .idea/copyright/profiles_settings.xml 29 | .idea/encodings.xml 30 | .idea/misc.xml 31 | .idea/modules.xml 32 | .idea/scopes/scope_settings.xml 33 | .idea/vcs.xml 34 | *.iml 35 | 36 | # OS-specific files 37 | .DS_Store 38 | .DS_Store? 39 | ._* 40 | .Spotlight-V100 41 | .Trashes 42 | ehthumbs.db 43 | Thumbs.db -------------------------------------------------------------------------------- /doc/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 |

All Classes

12 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /example/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | 6 | defaultConfig { 7 | applicationId "com.diegodobelo.expandinganimlib" 8 | minSdkVersion 15 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | testImplementation 'junit:junit:4.12' 24 | implementation 'androidx.appcompat:appcompat:1.0.0-rc01' 25 | implementation 'androidx.recyclerview:recyclerview:1.0.0-rc01' 26 | implementation 'com.diegodobelo.expandingview:expanding-view:0.9.4' 27 | } 28 | -------------------------------------------------------------------------------- /doc/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 |

All Classes

12 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | android.enableJetifier=true 20 | android.useAndroidX=true -------------------------------------------------------------------------------- /expanding-view/src/main/res/drawable/expanding_item_circle_base.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 17 | -------------------------------------------------------------------------------- /doc/com/diegodobelo/expandingview/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.diegodobelo.expandingview 7 | 8 | 9 | 10 | 11 |

com.diegodobelo.expandingview

12 |
13 |

Interfaces

14 | 17 |

Classes

18 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /example/src/main/res/layout/separator_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 18 | 19 | 23 | -------------------------------------------------------------------------------- /example/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 20 | 21 | 25 | 26 | -------------------------------------------------------------------------------- /example/src/main/res/layout/expanding_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | -------------------------------------------------------------------------------- /expanding-view/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /expanding-view/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | ext { 4 | bintrayRepo = 'maven' 5 | bintrayName = 'expanding-view' 6 | 7 | publishedGroupId = 'com.diegodobelo.expandingview' 8 | libraryName = 'ExpandingView' 9 | artifact = 'expanding-view' 10 | 11 | libraryDescription = 'Android library to create expandable list with animation.' 12 | 13 | siteUrl = 'https://github.com/diegodobelo/AndroidExpandingViewLibrary' 14 | gitUrl = 'https://github.com/diegodobelo/AndroidExpandingViewLibrary.git' 15 | 16 | libraryVersion = '0.9.4' 17 | 18 | developerId = 'diegodobelo' 19 | developerName = 'Diego Bezerra' 20 | developerEmail = 'diego.bezerra@gmail.com' 21 | 22 | licenseName = 'ISC' 23 | licenseUrl = 'https://opensource.org/licenses/ISC' 24 | allLicenses = ["ISC"] 25 | } 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | defaultConfig { 31 | minSdkVersion 15 32 | targetSdkVersion 28 33 | versionCode 94 34 | versionName "0.9.4" 35 | } 36 | buildTypes { 37 | release { 38 | minifyEnabled false 39 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 40 | } 41 | } 42 | 43 | tasks.withType(Javadoc).all { enabled = false } 44 | } 45 | 46 | dependencies { 47 | implementation fileTree(dir: 'libs', include: ['*.jar']) 48 | testImplementation 'junit:junit:4.12' 49 | implementation 'androidx.appcompat:appcompat:1.0.0-rc01' 50 | } 51 | 52 | apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' 53 | apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle' -------------------------------------------------------------------------------- /expanding-view/src/main/java/utils/CustomViewUtils.java: -------------------------------------------------------------------------------- 1 | package utils; 2 | 3 | import android.view.View; 4 | import android.view.ViewGroup; 5 | 6 | /** 7 | * View Utils class 8 | * Created by diego on 5/16/16. 9 | */ 10 | public class CustomViewUtils { 11 | /** 12 | * Set a View height in pixels. 13 | * 14 | * @param v The view to set the height. 15 | * @param height The height in pixels. 16 | */ 17 | public static void setViewHeight(View v, int height) { 18 | final ViewGroup.LayoutParams params = v.getLayoutParams(); 19 | params.height = height; 20 | v.requestLayout(); 21 | } 22 | 23 | /** 24 | * Set a View width in pixels. 25 | * 26 | * @param v The view to set the width. 27 | * @param width The width in pixels. 28 | */ 29 | public static void setViewWidth(View v, int width) { 30 | final ViewGroup.LayoutParams params = v.getLayoutParams(); 31 | params.width = width; 32 | v.requestLayout(); 33 | } 34 | 35 | /** 36 | * Set a View margin top. 37 | * 38 | * @param v The View to set the margin top. 39 | * @param marginTop the margin top in pixles 40 | */ 41 | public static void setViewMarginTop(View v, int marginTop) { 42 | setViewMargin(v, 0, marginTop, 0, 0); 43 | } 44 | 45 | /** 46 | * Set a View margin. 47 | * 48 | * @param v The view to set margins. 49 | * @param left The margin at left in pixels 50 | * @param top The margin at top in pixels 51 | * @param right The margin at right in pixels 52 | * @param bottom The margin at bottom in pixels 53 | */ 54 | public static void setViewMargin(View v, int left, int top, int right, int bottom) { 55 | final ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) v.getLayoutParams(); 56 | params.setMargins(left, top, right, bottom); 57 | v.requestLayout(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /example/src/main/res/layout/expanding_sub_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 18 | 19 | 33 | 34 | 45 | -------------------------------------------------------------------------------- /example/src/main/res/layout/expanding_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 18 | 19 | 29 | 30 | 40 | 41 | 52 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Generated Documentation (Untitled) 7 | 59 | 60 | 61 | 62 | 63 | 64 | <noscript> 65 | <div>JavaScript is disabled on your browser.</div> 66 | </noscript> 67 | <h2>Frame Alert</h2> 68 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="com/diegodobelo/expandingview/package-summary.html">Non-frame version</a>.</p> 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /expanding-view/src/main/res/layout/expanding_item_base_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 17 | 18 | 22 | 23 | 28 | 29 | 35 | 36 | 37 | 44 | 45 | 52 | 53 | 54 | 55 | 62 | 63 | 71 | 72 | 77 | 78 | -------------------------------------------------------------------------------- /doc/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deprecated List 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |
35 | 62 | 63 |
64 |

Deprecated API

65 |

Contents

66 |
67 | 68 |
69 | 70 | 71 | 72 | 73 | 81 |
82 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /doc/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Constant Field Values 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |
35 | 62 | 63 |
64 |

Constant Field Values

65 |

Contents

66 |
67 | 68 |
69 | 70 | 71 | 72 | 73 | 81 |
82 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /expanding-view/src/main/java/com/diegodobelo/expandingview/ExpandingList.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2016, Diego Bezerra 3 | * Permission to use, copy, modify, and/or distribute this software for any purpose 4 | * with or without fee is hereby granted, provided that the above copyright notice 5 | * and this permission notice appear in all copies. 6 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 7 | * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 8 | * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, 9 | * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 10 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 11 | * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 12 | **/ 13 | package com.diegodobelo.expandingview; 14 | 15 | import android.content.Context; 16 | import android.util.AttributeSet; 17 | import android.view.LayoutInflater; 18 | import android.view.ViewGroup; 19 | import android.widget.LinearLayout; 20 | import android.widget.ScrollView; 21 | 22 | /** 23 | * Created by diego on 5/9/16. 24 | * This is the Expanding List. User can create ExpandingItem by calling {@link #createNewItem(int)}. 25 | */ 26 | public class ExpandingList extends ScrollView { 27 | /** 28 | * Member variable to hold the items. 29 | */ 30 | private LinearLayout mContainer; 31 | 32 | /** 33 | * The constructor. 34 | * @param context The View Context. 35 | * @param attrs The attributes. 36 | */ 37 | public ExpandingList(Context context, AttributeSet attrs) { 38 | super(context, attrs); 39 | mContainer = new LinearLayout(context); 40 | mContainer.setOrientation(LinearLayout.VERTICAL); 41 | addView(mContainer); 42 | } 43 | 44 | /** 45 | * Method to add a new item. 46 | * @param item The ExpandingItem item. 47 | */ 48 | private void addItem(ExpandingItem item) { 49 | mContainer.addView(item); 50 | } 51 | 52 | /** 53 | * Method to create and add a new item. 54 | * @param layoutId The item Layout. 55 | * @return The created item. 56 | */ 57 | public ExpandingItem createNewItem(int layoutId) { 58 | LayoutInflater inflater = LayoutInflater.from(getContext()); 59 | ViewGroup item = (ViewGroup) inflater.inflate(layoutId, this, false); 60 | if (item instanceof ExpandingItem) { 61 | ExpandingItem expandingItem = (ExpandingItem) item; 62 | expandingItem.setParent(this); 63 | addItem(expandingItem); 64 | return expandingItem; 65 | } 66 | throw new RuntimeException("The layout id not an instance of com.diegodobelo.expandinganimlib.ExpandingItem"); 67 | } 68 | 69 | /** 70 | * Method to get an Item from the ExpandingList by its index. 71 | * @param index The index of the item. 72 | * @return An ExpandingItem in the list. 73 | */ 74 | public ExpandingItem getItemByIndex(int index) { 75 | if (index < 0 || index >= getItemsCount()) { 76 | throw new RuntimeException("Index must be grater than 0 and lesser than list size"); 77 | } 78 | return (ExpandingItem) mContainer.getChildAt(index); 79 | } 80 | 81 | /** 82 | * Return the items count. 83 | * @return Items count. 84 | */ 85 | public int getItemsCount() { 86 | return mContainer.getChildCount(); 87 | } 88 | 89 | /** 90 | * Method to remove an item. 91 | * @param item The item to be removed. 92 | */ 93 | public void removeItem(final ExpandingItem item) { 94 | mContainer.removeView(item); 95 | } 96 | 97 | 98 | /** 99 | * Method to remove all items. 100 | */ 101 | public void removeAllViews() { 102 | mContainer.removeAllViews(); 103 | } 104 | 105 | /** 106 | * Scroll up to show sub items 107 | * @param delta The calculated amount to scroll up. 108 | */ 109 | protected void scrollUpByDelta(final int delta) { 110 | post(new Runnable() { 111 | @Override 112 | public void run() { 113 | smoothScrollTo(0, getScrollY() + delta); 114 | } 115 | }); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /doc/overview-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Hierarchy 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |
35 | 62 | 63 |
64 |

Hierarchy For All Packages

65 | Package Hierarchies: 66 | 69 |
70 |
71 |

Class Hierarchy

72 |
    73 |
  • java.lang.Object 74 |
      75 |
    • RelativeLayout 76 | 79 |
    • 80 |
    81 |
  • 82 |
83 |

Interface Hierarchy

84 | 87 |
88 | 89 |
90 | 91 | 92 | 93 | 94 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/com/diegodobelo/expandingview/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.diegodobelo.expandingview Class Hierarchy 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |
35 | 62 | 63 |
64 |

Hierarchy For Package com.diegodobelo.expandingview

65 |
66 |
67 |

Class Hierarchy

68 |
    69 |
  • java.lang.Object 70 |
      71 |
    • RelativeLayout 72 | 75 |
    • 76 |
    77 |
  • 78 |
79 |

Interface Hierarchy

80 | 83 |
84 | 85 |
86 | 87 | 88 | 89 | 90 | 98 |
99 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /doc/com/diegodobelo/expandingview/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | com.diegodobelo.expandingview 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |
35 | 62 | 63 |
64 |

Package com.diegodobelo.expandingview

65 |
66 |
67 |
    68 |
  • 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 81 | 82 | 83 |
    Interface Summary 
    InterfaceDescription
    ExpandingItem.OnItemStateChanged 79 |
    Interface to notify item state changed.
    80 |
    84 |
  • 85 |
  • 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 98 | 99 | 100 |
    Class Summary 
    ClassDescription
    ExpandingItem 96 |
    Created by diego on 5/5/16.
    97 |
    101 |
  • 102 |
103 |
104 | 105 |
106 | 107 | 108 | 109 | 110 | 118 |
119 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /example/src/main/java/com/diegodobelo/expandinganimlib/MainActivity.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2016, Diego Bezerra 3 | * Permission to use, copy, modify, and/or distribute this software for any purpose 4 | * with or without fee is hereby granted, provided that the above copyright notice 5 | * and this permission notice appear in all copies. 6 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 7 | * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 8 | * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, 9 | * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 10 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 11 | * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 12 | **/ 13 | package com.diegodobelo.expandinganimlib; 14 | 15 | import android.content.DialogInterface; 16 | import android.os.Bundle; 17 | import android.view.View; 18 | import android.widget.EditText; 19 | import android.widget.TextView; 20 | 21 | import com.diegodobelo.expandingview.ExpandingItem; 22 | import com.diegodobelo.expandingview.ExpandingList; 23 | 24 | import androidx.appcompat.app.AlertDialog; 25 | import androidx.appcompat.app.AppCompatActivity; 26 | 27 | public class MainActivity extends AppCompatActivity { 28 | private ExpandingList mExpandingList; 29 | 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_main); 34 | mExpandingList = findViewById(R.id.expanding_list_main); 35 | createItems(); 36 | } 37 | 38 | private void createItems() { 39 | addItem("John", new String[]{"House", "Boat", "Candy", "Collection", "Sport", "Ball", "Head"}, R.color.pink, R.drawable.ic_ghost); 40 | addItem("Mary", new String[]{"Dog", "Horse", "Boat"}, R.color.blue, R.drawable.ic_ghost); 41 | addItem("Ana", new String[]{"Cat"}, R.color.purple, R.drawable.ic_ghost); 42 | addItem("Peter", new String[]{"Parrot", "Elephant", "Coffee"}, R.color.yellow, R.drawable.ic_ghost); 43 | addItem("Joseph", new String[]{}, R.color.orange, R.drawable.ic_ghost); 44 | addItem("Paul", new String[]{"Golf", "Football"}, R.color.green, R.drawable.ic_ghost); 45 | addItem("Larry", new String[]{"Ferrari", "Mazda", "Honda", "Toyota", "Fiat"}, R.color.blue, R.drawable.ic_ghost); 46 | addItem("Moe", new String[]{"Beans", "Rice", "Meat"}, R.color.yellow, R.drawable.ic_ghost); 47 | addItem("Bart", new String[]{"Hamburger", "Ice cream", "Candy"}, R.color.purple, R.drawable.ic_ghost); 48 | } 49 | 50 | private void addItem(String title, String[] subItems, int colorRes, int iconRes) { 51 | //Let's create an item with R.layout.expanding_layout 52 | final ExpandingItem item = mExpandingList.createNewItem(R.layout.expanding_layout); 53 | 54 | //If item creation is successful, let's configure it 55 | if (item != null) { 56 | item.setIndicatorColorRes(colorRes); 57 | item.setIndicatorIconRes(iconRes); 58 | //It is possible to get any view inside the inflated layout. Let's set the text in the item 59 | ((TextView) item.findViewById(R.id.title)).setText(title); 60 | 61 | //We can create items in batch. 62 | item.createSubItems(subItems.length); 63 | for (int i = 0; i < item.getSubItemsCount(); i++) { 64 | //Let's get the created sub item by its index 65 | final View view = item.getSubItemView(i); 66 | 67 | //Let's set some values in 68 | configureSubItem(item, view, subItems[i]); 69 | } 70 | item.findViewById(R.id.add_more_sub_items).setOnClickListener(new View.OnClickListener() { 71 | @Override 72 | public void onClick(View v) { 73 | showInsertDialog(new OnItemCreated() { 74 | @Override 75 | public void itemCreated(String title) { 76 | View newSubItem = item.createSubItem(); 77 | configureSubItem(item, newSubItem, title); 78 | } 79 | }); 80 | } 81 | }); 82 | 83 | item.findViewById(R.id.remove_item).setOnClickListener(new View.OnClickListener() { 84 | @Override 85 | public void onClick(View v) { 86 | mExpandingList.removeItem(item); 87 | } 88 | }); 89 | } 90 | } 91 | 92 | private void configureSubItem(final ExpandingItem item, final View view, String subTitle) { 93 | ((TextView) view.findViewById(R.id.sub_title)).setText(subTitle); 94 | view.findViewById(R.id.remove_sub_item).setOnClickListener(new View.OnClickListener() { 95 | @Override 96 | public void onClick(View v) { 97 | item.removeSubItem(view); 98 | } 99 | }); 100 | } 101 | 102 | private void showInsertDialog(final OnItemCreated positive) { 103 | final EditText text = new EditText(this); 104 | AlertDialog.Builder builder = new AlertDialog.Builder(this); 105 | builder.setView(text); 106 | builder.setTitle(R.string.enter_title); 107 | builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { 108 | @Override 109 | public void onClick(DialogInterface dialog, int which) { 110 | positive.itemCreated(text.getText().toString()); 111 | } 112 | }); 113 | builder.setNegativeButton(android.R.string.cancel, null); 114 | builder.show(); 115 | } 116 | 117 | interface OnItemCreated { 118 | void itemCreated(String title); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /doc/com/diegodobelo/expandingview/ExpandingItem.OnItemStateChanged.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ExpandingItem.OnItemStateChanged 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |
35 | 77 | 78 | 79 |
80 |
com.diegodobelo.expandingview
81 |

Interface ExpandingItem.OnItemStateChanged

82 |
83 |
84 |
85 |
    86 |
  • 87 |
    88 |
    Enclosing class:
    89 |
    ExpandingItem
    90 |
    91 |
    92 |
    93 |
    public static interface ExpandingItem.OnItemStateChanged
    94 |
    Interface to notify item state changed.
    95 |
  • 96 |
97 |
98 |
99 |
    100 |
  • 101 | 102 |
      103 |
    • 104 | 105 | 106 |

      Method Summary

      107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 118 | 119 |
      Methods 
      Modifier and TypeMethod and Description
      voiditemCollapseStateChanged(boolean expanded) 116 |
      Notify if item was expanded or collapsed.
      117 |
      120 |
    • 121 |
    122 |
  • 123 |
124 |
125 |
126 |
    127 |
  • 128 | 129 |
      130 |
    • 131 | 132 | 133 |

      Method Detail

      134 | 135 | 136 | 137 |
        138 |
      • 139 |

        itemCollapseStateChanged

        140 |
        void itemCollapseStateChanged(boolean expanded)
        141 |
        Notify if item was expanded or collapsed.
        142 |
        Parameters:
        expanded - true if expanded. false otherwise.
        143 |
      • 144 |
      145 |
    • 146 |
    147 |
  • 148 |
149 |
150 |
151 | 152 | 153 |
154 | 155 | 156 | 157 | 158 | 166 |
167 | 209 | 210 | 211 | 212 | -------------------------------------------------------------------------------- /doc/help-doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | API Help 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |
35 | 62 | 63 |
64 |

How This API Document Is Organized

65 |
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
66 |
67 |
68 |
    69 |
  • 70 |

    Package

    71 |

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    72 |
      73 |
    • Interfaces (italic)
    • 74 |
    • Classes
    • 75 |
    • Enums
    • 76 |
    • Exceptions
    • 77 |
    • Errors
    • 78 |
    • Annotation Types
    • 79 |
    80 |
  • 81 |
  • 82 |

    Class/Interface

    83 |

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    84 |
      85 |
    • Class inheritance diagram
    • 86 |
    • Direct Subclasses
    • 87 |
    • All Known Subinterfaces
    • 88 |
    • All Known Implementing Classes
    • 89 |
    • Class/interface declaration
    • 90 |
    • Class/interface description
    • 91 |
    92 |
      93 |
    • Nested Class Summary
    • 94 |
    • Field Summary
    • 95 |
    • Constructor Summary
    • 96 |
    • Method Summary
    • 97 |
    98 |
      99 |
    • Field Detail
    • 100 |
    • Constructor Detail
    • 101 |
    • Method Detail
    • 102 |
    103 |

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

    104 |
  • 105 |
  • 106 |

    Annotation Type

    107 |

    Each annotation type has its own separate page with the following sections:

    108 |
      109 |
    • Annotation Type declaration
    • 110 |
    • Annotation Type description
    • 111 |
    • Required Element Summary
    • 112 |
    • Optional Element Summary
    • 113 |
    • Element Detail
    • 114 |
    115 |
  • 116 |
  • 117 |

    Enum

    118 |

    Each enum has its own separate page with the following sections:

    119 |
      120 |
    • Enum declaration
    • 121 |
    • Enum description
    • 122 |
    • Enum Constant Summary
    • 123 |
    • Enum Constant Detail
    • 124 |
    125 |
  • 126 |
  • 127 |

    Tree (Class Hierarchy)

    128 |

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    129 |
      130 |
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • 131 |
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    • 132 |
    133 |
  • 134 |
  • 135 |

    Deprecated API

    136 |

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

    137 |
  • 138 |
  • 139 |

    Index

    140 |

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

    141 |
  • 142 |
  • 143 |

    Prev/Next

    144 |

    These links take you to the next or previous class, interface, package, or related page.

    145 |
  • 146 |
  • 147 |

    Frames/No Frames

    148 |

    These links show and hide the HTML frames. All pages are available with or without frames.

    149 |
  • 150 |
  • 151 |

    All Classes

    152 |

    The All Classes link shows all classes and interfaces except non-static nested types.

    153 |
  • 154 |
  • 155 |

    Serialized Form

    156 |

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

    157 |
  • 158 |
  • 159 |

    Constant Field Values

    160 |

    The Constant Field Values page lists the static final fields and their values.

    161 |
  • 162 |
163 | This help file applies to API documentation generated using the standard doclet.
164 | 165 |
166 | 167 | 168 | 169 | 170 | 178 |
179 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AndroidExpandingViewLibrary-green.svg?style=true)](https://android-arsenal.com/details/1/3667) 2 | ## About the Library 3 | 4 | ### inspiration 5 | This library is strongly inspired in this concept from [Hila Peleg in dribble](https://dribbble.com/shots/2340386-Shopping-List). 6 | See it below 7 | 8 | ![Android Arsenal](https://raw.githubusercontent.com/tamzi/AndroidExpandingViewLibrary/master/art/shoping_list.gif) 9 | 10 | 11 | ### Working example 12 | For more details on how to use this library please refer to the example in this repository. You can see a video of the example working here: 13 | 14 | [![a video of the example working here](https://img.youtube.com/vi/moWaruuaEP0/0.jpg)](https://www.youtube.com/watch?v=moWaruuaEP0) 15 | 16 | 17 | 18 | ## Adding the Library to gradle file 19 | ```gradle 20 | dependencies { 21 | compile 'com.diegodobelo.expandingview:expanding-view:0.9.4' 22 | } 23 | ``` 24 | 25 | ## Using the Library 26 | ### Layouts 27 | First of all include the ExpandingList in your Activity (or Fragment) layout. This will be the list of items (ExpandItem): 28 | 29 | ```xml 30 | 34 | ``` 35 | 36 | Now create a new layout (xml) file to represent the item (such as `res/layout/expanding_item.xml`). This will be the Item (header) that can be expanded to show sub items: 37 | 38 | ```xml 39 | 43 | 50 | 51 | ``` 52 | 53 | Create another layout file to represent the sub items (such as `/res/expanding_sub_item.xml`). This will be the sub items that will be shown when the Item is expanded: 54 | 55 | ```xml 56 | 60 | 68 | 69 | ``` 70 | 71 | Now create a layout file (such as `/res/expanding_layout.xml`) to represent the whole item, including both item layout and sub item layout. We will explain each custom attribute later: 72 | 73 | ```xml 74 | 88 | ``` 89 | 90 | Note that we included `expanding_item` and `expanding_sub_item` layouts created before. 91 | 92 | ### Java code 93 | 94 | Now that you have all the required layouts you are able to use them in Java code. Let's start inflating the ExpandingList: 95 | 96 | ```java 97 | ExpandingList expandingList = (ExpandingList) findViewById(R.id.expanding_list_main); 98 | ``` 99 | 100 | Create a new ExpandingItem in the ExpandingList. This method receives the `expanding_layout` created before. Yes! We can have different layouts for different items in the same list. The items will be created based on `expanding_item` layout and the sub items will be created based on `expanding_sub_item` layout: 101 | 102 | ```java 103 | ExpandingItem item = expandingList.createNewItem(R.layout.expanding_layout); 104 | 105 | /*ExpandingItem extends from View, so you can call 106 | findViewById to get any View inside the layout*/ 107 | (TextView) item.findViewById(R.id.title)).setText("It Works!!"); 108 | ``` 109 | 110 | Let's create the sub items. There is a method to create items in batch: 111 | 112 | ```java 113 | //This will create 5 items 114 | item.createSubItems(5); 115 | 116 | //get a sub item View 117 | View subItemZero = item.getSubItemView(0); 118 | ((TextView) subItemZero.findViewById(R.id.sub_title)).setText("Cool"); 119 | 120 | View subItemOne = item.getSubItemView(1); 121 | ((TextView) subItemOne.findViewById(R.id.sub_title)).setText("Awesome"); 122 | 123 | ... 124 | 125 | ``` 126 | 127 | For each item you can set the indicator color and the indicator icon: 128 | 129 | ```java 130 | item.setIndicatorColorRes(R.color.blue); 131 | item.setIndicatorIconRes(R.drawable.ic_icon); 132 | 133 | ``` 134 | ### ExpandingItem layout attributes 135 | 136 | Attribute Name | Type | Default Value | Meaning | Mandatory 137 | ---------------------- | ------------ | ------------- | --------------------------------------------------------------------| -------- 138 | item_layout | reference | | The layout for the Item (header). | Yes 139 | sub_item_layout | reference | | The layout for the sub items. | Yes 140 | separator_layout | reference | | A layout to separate items. | No 141 | indicator_size | dimension | 0dp | The indicator size in dp. | No 142 | indicator_margin_left | dimension | 0dp | The margin between the indicator and its left. | No 143 | indicator_margin_right | dimension | 0dp | The margin between the indicator and its right. | No 144 | show_indicator | boolean | true | true if you want to show the indicator. false otherwise. | No 145 | show_animation | boolean | true | true if you want to show animations. false otherwise. | No 146 | start_collapsed | boolean | true | true if you want the sub views to start collapsed. false otherwise. | No 147 | animation_duration | integer | 300ms | The animations duration in milliseconds. | No 148 | 149 | ## ExpandingList public methods 150 | 151 | ##### `public void createNewItem(int layoutId)` 152 | 153 | Method to create and add a new item. 154 | 155 | * **Parameters:** `layoutId` — The item Layout 156 | 157 | ##### `public void removeItem(ExpandingItem item)` 158 | 159 | Method to remove an item. 160 | 161 | * **Parameters:** `item` — The item to be removed, of type {@link ExpandingItem} 162 | 163 | ##### `public void removeAllViews()` 164 | 165 | Method to remove all items. 166 | 167 | ##### `ExpandingItem getItemByIndex(int index)` 168 | 169 | Method to get an Item from the ExpandingList by its index. 170 | 171 | * **Parameters:** `index` — The index of the item. 172 | * **Returns:** An {@link ExpandingItem} in the list. 173 | 174 | ##### `public int getItemsCount()` 175 | 176 | Return how many items exists in the list. 177 | 178 | * **Returns:** Items count. 179 | 180 | ## ExpandingItem public methods 181 | 182 | ##### `public void setStateChangedListener(OnItemStateChanged listener)` 183 | 184 | Set a listener to listen item stage changed. 185 | 186 | * **Parameters:** `listener` — The listener of type {@link OnItemStateChanged} 187 | 188 | ##### `public boolean isExpanded()` 189 | 190 | Tells if the item is expanded. 191 | 192 | * **Returns:** true if expanded. false otherwise. 193 | 194 | ##### `public int getSubItemsCount()` 195 | 196 | Returns the count of sub items. 197 | 198 | * **Returns:** The count of sub items. 199 | 200 | ##### `public void collapse()` 201 | 202 | Collapses the sub items. 203 | 204 | ##### `public void toggleExpanded()` 205 | 206 | Expand or collapse the sub items. 207 | 208 | ##### `public void setIndicatorColorRes(int colorRes)` 209 | 210 | Set the indicator color by resource. 211 | 212 | * **Parameters:** `colorRes` — The color resource. 213 | 214 | ##### `public void setIndicatorColor(int color)` 215 | 216 | Set the indicator color by color value. 217 | 218 | * **Parameters:** `color` — The color value. 219 | 220 | ##### `public void setIndicatorIconRes(int iconRes)` 221 | 222 | Set the indicator icon by resource. 223 | 224 | * **Parameters:** `iconRes` — The icon resource. 225 | 226 | ##### `public void setIndicatorIcon(Drawable icon)` 227 | 228 | Set the indicator icon. 229 | 230 | * **Parameters:** `icon` — Drawable of the indicator icon. 231 | 232 | ##### `@Nullable public View createSubItem()` 233 | 234 | Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute. 235 | 236 | * **Returns:** The inflated sub item view. 237 | 238 | ##### `@Nullable public View createSubItem(int position)` 239 | 240 | Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute. If position is -1, the item will be added in the end of the list. 241 | 242 | * **Parameters:** `position` — The position to add the new Item. Position should not be greater than the list size. 243 | * **Returns:** The inflated sub item view. 244 | 245 | ##### `public void createSubItems(int count)` 246 | 247 | Creates as many sub items as requested in {@param count}. 248 | 249 | * **Parameters:** `count` — The quantity of sub items. 250 | 251 | ##### `public View getSubItemView(int position)` 252 | 253 | Get a sub item at the given position. 254 | 255 | * **Parameters:** `position` — The sub item position. Should be > 0. 256 | * **Returns:** The sub item inflated view at the given position. 257 | 258 | ##### `public void removeSubItemAt(int position)` 259 | 260 | Remove sub item at the given position. 261 | 262 | * **Parameters:** `position` — The position of the item to be removed. 263 | 264 | ##### `public void removeSubItemFromList(View view)` 265 | 266 | Remove the given view representing the sub item. Should be an existing sub item. 267 | 268 | * **Parameters:** `view` — The sub item to be removed. 269 | 270 | ##### `public void removeSubItem(View view)` 271 | 272 | Remove the given view representing the sub item, with animation. Should be an existing sub item. 273 | 274 | * **Parameters:** `view` — The sub item to be removed. 275 | 276 | ##### `public void removeAllSubItems()` 277 | 278 | Remove all sub items. 279 | 280 | ## License 281 | ``` 282 | Copyright (c) 2016, Diego Bezerra 283 | Permission to use, copy, modify, and/or distribute this software for any purpose 284 | with or without fee is hereby granted, provided that the above copyright notice 285 | and this permission notice appear in all copies. 286 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 287 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 288 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, 289 | OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 290 | DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 291 | ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 292 | ``` 293 | -------------------------------------------------------------------------------- /doc/stylesheet.css: -------------------------------------------------------------------------------- 1 | /* Javadoc style sheet */ 2 | /* 3 | Overall document style 4 | */ 5 | body { 6 | background-color:#ffffff; 7 | color:#353833; 8 | font-family:Arial, Helvetica, sans-serif; 9 | font-size:76%; 10 | margin:0; 11 | } 12 | a:link, a:visited { 13 | text-decoration:none; 14 | color:#4c6b87; 15 | } 16 | a:hover, a:focus { 17 | text-decoration:none; 18 | color:#bb7a2a; 19 | } 20 | a:active { 21 | text-decoration:none; 22 | color:#4c6b87; 23 | } 24 | a[name] { 25 | color:#353833; 26 | } 27 | a[name]:hover { 28 | text-decoration:none; 29 | color:#353833; 30 | } 31 | pre { 32 | font-size:1.3em; 33 | } 34 | h1 { 35 | font-size:1.8em; 36 | } 37 | h2 { 38 | font-size:1.5em; 39 | } 40 | h3 { 41 | font-size:1.4em; 42 | } 43 | h4 { 44 | font-size:1.3em; 45 | } 46 | h5 { 47 | font-size:1.2em; 48 | } 49 | h6 { 50 | font-size:1.1em; 51 | } 52 | ul { 53 | list-style-type:disc; 54 | } 55 | code, tt { 56 | font-size:1.2em; 57 | } 58 | dt code { 59 | font-size:1.2em; 60 | } 61 | table tr td dt code { 62 | font-size:1.2em; 63 | vertical-align:top; 64 | } 65 | sup { 66 | font-size:.6em; 67 | } 68 | /* 69 | Document title and Copyright styles 70 | */ 71 | .clear { 72 | clear:both; 73 | height:0px; 74 | overflow:hidden; 75 | } 76 | .aboutLanguage { 77 | float:right; 78 | padding:0px 21px; 79 | font-size:.8em; 80 | z-index:200; 81 | margin-top:-7px; 82 | } 83 | .legalCopy { 84 | margin-left:.5em; 85 | } 86 | .bar a, .bar a:link, .bar a:visited, .bar a:active { 87 | color:#FFFFFF; 88 | text-decoration:none; 89 | } 90 | .bar a:hover, .bar a:focus { 91 | color:#bb7a2a; 92 | } 93 | .tab { 94 | background-color:#0066FF; 95 | background-image:url(resources/titlebar.gif); 96 | background-position:left top; 97 | background-repeat:no-repeat; 98 | color:#ffffff; 99 | padding:8px; 100 | width:5em; 101 | font-weight:bold; 102 | } 103 | /* 104 | Navigation bar styles 105 | */ 106 | .bar { 107 | background-image:url(resources/background.gif); 108 | background-repeat:repeat-x; 109 | color:#FFFFFF; 110 | padding:.8em .5em .4em .8em; 111 | height:auto;/*height:1.8em;*/ 112 | font-size:1em; 113 | margin:0; 114 | } 115 | .topNav { 116 | background-image:url(resources/background.gif); 117 | background-repeat:repeat-x; 118 | color:#FFFFFF; 119 | float:left; 120 | padding:0; 121 | width:100%; 122 | clear:right; 123 | height:2.8em; 124 | padding-top:10px; 125 | overflow:hidden; 126 | } 127 | .bottomNav { 128 | margin-top:10px; 129 | background-image:url(resources/background.gif); 130 | background-repeat:repeat-x; 131 | color:#FFFFFF; 132 | float:left; 133 | padding:0; 134 | width:100%; 135 | clear:right; 136 | height:2.8em; 137 | padding-top:10px; 138 | overflow:hidden; 139 | } 140 | .subNav { 141 | background-color:#dee3e9; 142 | border-bottom:1px solid #9eadc0; 143 | float:left; 144 | width:100%; 145 | overflow:hidden; 146 | } 147 | .subNav div { 148 | clear:left; 149 | float:left; 150 | padding:0 0 5px 6px; 151 | } 152 | ul.navList, ul.subNavList { 153 | float:left; 154 | margin:0 25px 0 0; 155 | padding:0; 156 | } 157 | ul.navList li{ 158 | list-style:none; 159 | float:left; 160 | padding:3px 6px; 161 | } 162 | ul.subNavList li{ 163 | list-style:none; 164 | float:left; 165 | font-size:90%; 166 | } 167 | .topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited { 168 | color:#FFFFFF; 169 | text-decoration:none; 170 | } 171 | .topNav a:hover, .bottomNav a:hover { 172 | text-decoration:none; 173 | color:#bb7a2a; 174 | } 175 | .navBarCell1Rev { 176 | background-image:url(resources/tab.gif); 177 | background-color:#a88834; 178 | color:#FFFFFF; 179 | margin: auto 5px; 180 | border:1px solid #c9aa44; 181 | } 182 | /* 183 | Page header and footer styles 184 | */ 185 | .header, .footer { 186 | clear:both; 187 | margin:0 20px; 188 | padding:5px 0 0 0; 189 | } 190 | .indexHeader { 191 | margin:10px; 192 | position:relative; 193 | } 194 | .indexHeader h1 { 195 | font-size:1.3em; 196 | } 197 | .title { 198 | color:#2c4557; 199 | margin:10px 0; 200 | } 201 | .subTitle { 202 | margin:5px 0 0 0; 203 | } 204 | .header ul { 205 | margin:0 0 25px 0; 206 | padding:0; 207 | } 208 | .footer ul { 209 | margin:20px 0 5px 0; 210 | } 211 | .header ul li, .footer ul li { 212 | list-style:none; 213 | font-size:1.2em; 214 | } 215 | /* 216 | Heading styles 217 | */ 218 | div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 { 219 | background-color:#dee3e9; 220 | border-top:1px solid #9eadc0; 221 | border-bottom:1px solid #9eadc0; 222 | margin:0 0 6px -8px; 223 | padding:2px 5px; 224 | } 225 | ul.blockList ul.blockList ul.blockList li.blockList h3 { 226 | background-color:#dee3e9; 227 | border-top:1px solid #9eadc0; 228 | border-bottom:1px solid #9eadc0; 229 | margin:0 0 6px -8px; 230 | padding:2px 5px; 231 | } 232 | ul.blockList ul.blockList li.blockList h3 { 233 | padding:0; 234 | margin:15px 0; 235 | } 236 | ul.blockList li.blockList h2 { 237 | padding:0px 0 20px 0; 238 | } 239 | /* 240 | Page layout container styles 241 | */ 242 | .contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer { 243 | clear:both; 244 | padding:10px 20px; 245 | position:relative; 246 | } 247 | .indexContainer { 248 | margin:10px; 249 | position:relative; 250 | font-size:1.0em; 251 | } 252 | .indexContainer h2 { 253 | font-size:1.1em; 254 | padding:0 0 3px 0; 255 | } 256 | .indexContainer ul { 257 | margin:0; 258 | padding:0; 259 | } 260 | .indexContainer ul li { 261 | list-style:none; 262 | } 263 | .contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt { 264 | font-size:1.1em; 265 | font-weight:bold; 266 | margin:10px 0 0 0; 267 | color:#4E4E4E; 268 | } 269 | .contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd { 270 | margin:10px 0 10px 20px; 271 | } 272 | .serializedFormContainer dl.nameValue dt { 273 | margin-left:1px; 274 | font-size:1.1em; 275 | display:inline; 276 | font-weight:bold; 277 | } 278 | .serializedFormContainer dl.nameValue dd { 279 | margin:0 0 0 1px; 280 | font-size:1.1em; 281 | display:inline; 282 | } 283 | /* 284 | List styles 285 | */ 286 | ul.horizontal li { 287 | display:inline; 288 | font-size:0.9em; 289 | } 290 | ul.inheritance { 291 | margin:0; 292 | padding:0; 293 | } 294 | ul.inheritance li { 295 | display:inline; 296 | list-style:none; 297 | } 298 | ul.inheritance li ul.inheritance { 299 | margin-left:15px; 300 | padding-left:15px; 301 | padding-top:1px; 302 | } 303 | ul.blockList, ul.blockListLast { 304 | margin:10px 0 10px 0; 305 | padding:0; 306 | } 307 | ul.blockList li.blockList, ul.blockListLast li.blockList { 308 | list-style:none; 309 | margin-bottom:25px; 310 | } 311 | ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList { 312 | padding:0px 20px 5px 10px; 313 | border:1px solid #9eadc0; 314 | background-color:#f9f9f9; 315 | } 316 | ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList { 317 | padding:0 0 5px 8px; 318 | background-color:#ffffff; 319 | border:1px solid #9eadc0; 320 | border-top:none; 321 | } 322 | ul.blockList ul.blockList ul.blockList ul.blockList li.blockList { 323 | margin-left:0; 324 | padding-left:0; 325 | padding-bottom:15px; 326 | border:none; 327 | border-bottom:1px solid #9eadc0; 328 | } 329 | ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast { 330 | list-style:none; 331 | border-bottom:none; 332 | padding-bottom:0; 333 | } 334 | table tr td dl, table tr td dl dt, table tr td dl dd { 335 | margin-top:0; 336 | margin-bottom:1px; 337 | } 338 | /* 339 | Table styles 340 | */ 341 | .contentContainer table, .classUseContainer table, .constantValuesContainer table { 342 | border-bottom:1px solid #9eadc0; 343 | width:100%; 344 | } 345 | .contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table { 346 | width:100%; 347 | } 348 | .contentContainer .description table, .contentContainer .details table { 349 | border-bottom:none; 350 | } 351 | .contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td{ 352 | vertical-align:top; 353 | padding-right:20px; 354 | } 355 | .contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast, 356 | .contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast, 357 | .contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne, 358 | .contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne { 359 | padding-right:3px; 360 | } 361 | .overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption { 362 | position:relative; 363 | text-align:left; 364 | background-repeat:no-repeat; 365 | color:#FFFFFF; 366 | font-weight:bold; 367 | clear:none; 368 | overflow:hidden; 369 | padding:0px; 370 | margin:0px; 371 | } 372 | caption a:link, caption a:hover, caption a:active, caption a:visited { 373 | color:#FFFFFF; 374 | } 375 | .overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span { 376 | white-space:nowrap; 377 | padding-top:8px; 378 | padding-left:8px; 379 | display:block; 380 | float:left; 381 | background-image:url(resources/titlebar.gif); 382 | height:18px; 383 | } 384 | .overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { 385 | width:10px; 386 | background-image:url(resources/titlebar_end.gif); 387 | background-repeat:no-repeat; 388 | background-position:top right; 389 | position:relative; 390 | float:left; 391 | } 392 | ul.blockList ul.blockList li.blockList table { 393 | margin:0 0 12px 0px; 394 | width:100%; 395 | } 396 | .tableSubHeadingColor { 397 | background-color: #EEEEFF; 398 | } 399 | .altColor { 400 | background-color:#eeeeef; 401 | } 402 | .rowColor { 403 | background-color:#ffffff; 404 | } 405 | .overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td { 406 | text-align:left; 407 | padding:3px 3px 3px 7px; 408 | } 409 | th.colFirst, th.colLast, th.colOne, .constantValuesContainer th { 410 | background:#dee3e9; 411 | border-top:1px solid #9eadc0; 412 | border-bottom:1px solid #9eadc0; 413 | text-align:left; 414 | padding:3px 3px 3px 7px; 415 | } 416 | td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover { 417 | font-weight:bold; 418 | } 419 | td.colFirst, th.colFirst { 420 | border-left:1px solid #9eadc0; 421 | white-space:nowrap; 422 | } 423 | td.colLast, th.colLast { 424 | border-right:1px solid #9eadc0; 425 | } 426 | td.colOne, th.colOne { 427 | border-right:1px solid #9eadc0; 428 | border-left:1px solid #9eadc0; 429 | } 430 | table.overviewSummary { 431 | padding:0px; 432 | margin-left:0px; 433 | } 434 | table.overviewSummary td.colFirst, table.overviewSummary th.colFirst, 435 | table.overviewSummary td.colOne, table.overviewSummary th.colOne { 436 | width:25%; 437 | vertical-align:middle; 438 | } 439 | table.packageSummary td.colFirst, table.overviewSummary th.colFirst { 440 | width:25%; 441 | vertical-align:middle; 442 | } 443 | /* 444 | Content styles 445 | */ 446 | .description pre { 447 | margin-top:0; 448 | } 449 | .deprecatedContent { 450 | margin:0; 451 | padding:10px 0; 452 | } 453 | .docSummary { 454 | padding:0; 455 | } 456 | /* 457 | Formatting effect styles 458 | */ 459 | .sourceLineNo { 460 | color:green; 461 | padding:0 30px 0 0; 462 | } 463 | h1.hidden { 464 | visibility:hidden; 465 | overflow:hidden; 466 | font-size:.9em; 467 | } 468 | .block { 469 | display:block; 470 | margin:3px 0 0 0; 471 | } 472 | .strong { 473 | font-weight:bold; 474 | } 475 | -------------------------------------------------------------------------------- /doc/index-all.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Index 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |
35 | 62 | 63 |
C E G I R S T  64 | 65 | 66 |

C

67 |
68 |
collapse() - Method in class com.diegodobelo.expandingview.ExpandingItem
69 |
70 |
Collapses the sub items.
71 |
72 |
com.diegodobelo.expandingview - package com.diegodobelo.expandingview
73 |
 
74 |
createSubItem() - Method in class com.diegodobelo.expandingview.ExpandingItem
75 |
76 |
Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute.
77 |
78 |
createSubItem(int) - Method in class com.diegodobelo.expandingview.ExpandingItem
79 |
80 |
Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute.
81 |
82 |
createSubItems(int) - Method in class com.diegodobelo.expandingview.ExpandingItem
83 |
84 |
Creates as many sub items as requested in .
85 |
86 |
87 | 88 | 89 | 90 |

E

91 |
92 |
ExpandingItem - Class in com.diegodobelo.expandingview
93 |
94 |
Created by diego on 5/5/16.
95 |
96 |
ExpandingItem(Context, AttributeSet) - Constructor for class com.diegodobelo.expandingview.ExpandingItem
97 |
98 |
Constructor.
99 |
100 |
ExpandingItem.OnItemStateChanged - Interface in com.diegodobelo.expandingview
101 |
102 |
Interface to notify item state changed.
103 |
104 |
105 | 106 | 107 | 108 |

G

109 |
110 |
getSubItemsCount() - Method in class com.diegodobelo.expandingview.ExpandingItem
111 |
112 |
Returns the count of sub items.
113 |
114 |
getSubItemView(int) - Method in class com.diegodobelo.expandingview.ExpandingItem
115 |
116 |
Get a sub item at the given position.
117 |
118 |
119 | 120 | 121 | 122 |

I

123 |
124 |
isExpanded() - Method in class com.diegodobelo.expandingview.ExpandingItem
125 |
126 |
Tells if the item is expanded.
127 |
128 |
itemCollapseStateChanged(boolean) - Method in interface com.diegodobelo.expandingview.ExpandingItem.OnItemStateChanged
129 |
130 |
Notify if item was expanded or collapsed.
131 |
132 |
133 | 134 | 135 | 136 |

R

137 |
138 |
removeAllSubItems() - Method in class com.diegodobelo.expandingview.ExpandingItem
139 |
140 |
Remove all sub items.
141 |
142 |
removeSubItem(View) - Method in class com.diegodobelo.expandingview.ExpandingItem
143 |
144 |
Remove the given view representing the sub item, with animation.
145 |
146 |
removeSubItemAt(int) - Method in class com.diegodobelo.expandingview.ExpandingItem
147 |
148 |
Remove sub item at the given position.
149 |
150 |
removeSubItemFromList(View) - Method in class com.diegodobelo.expandingview.ExpandingItem
151 |
152 |
Remove the given view representing the sub item.
153 |
154 |
155 | 156 | 157 | 158 |

S

159 |
160 |
setIndicatorColor(int) - Method in class com.diegodobelo.expandingview.ExpandingItem
161 |
162 |
Set the indicator color by color value.
163 |
164 |
setIndicatorColorRes(int) - Method in class com.diegodobelo.expandingview.ExpandingItem
165 |
166 |
Set the indicator color by resource.
167 |
168 |
setIndicatorIcon(Drawable) - Method in class com.diegodobelo.expandingview.ExpandingItem
169 |
170 |
Set the indicator icon.
171 |
172 |
setIndicatorIconRes(int) - Method in class com.diegodobelo.expandingview.ExpandingItem
173 |
174 |
Set the indicator icon by resource.
175 |
176 |
setParent(ExpandingList) - Method in class com.diegodobelo.expandingview.ExpandingItem
177 |
178 |
Set the parent in order to auto scroll.
179 |
180 |
setStateChangedListener(ExpandingItem.OnItemStateChanged) - Method in class com.diegodobelo.expandingview.ExpandingItem
181 |
182 |
Set a listener to listen item stage changed.
183 |
184 |
185 | 186 | 187 | 188 |

T

189 |
190 |
toggleExpanded() - Method in class com.diegodobelo.expandingview.ExpandingItem
191 |
192 |
Expand or collapse the sub items.
193 |
194 |
195 | C E G I R S T 
196 | 197 |
198 | 199 | 200 | 201 | 202 | 210 |
211 | 238 | 239 | 240 | 241 | -------------------------------------------------------------------------------- /doc/com/diegodobelo/expandingview/ExpandingItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ExpandingItem 7 | 8 | 9 | 10 | 11 | 17 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 34 |
35 | 77 | 78 | 79 |
80 |
com.diegodobelo.expandingview
81 |

Class ExpandingItem

82 |
83 |
84 |
    85 |
  • java.lang.Object
  • 86 |
  • 87 |
      88 |
    • RelativeLayout
    • 89 |
    • 90 |
        91 |
      • com.diegodobelo.expandingview.ExpandingItem
      • 92 |
      93 |
    • 94 |
    95 |
  • 96 |
97 |
98 |
    99 |
  • 100 |
    101 |
    102 |
    public class ExpandingItem
    103 | extends RelativeLayout
    104 |
    Created by diego on 5/5/16.
    105 |
  • 106 |
107 |
108 |
109 |
    110 |
  • 111 | 112 |
      113 |
    • 114 | 115 | 116 |

      Nested Class Summary

      117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 128 | 129 |
      Nested Classes 
      Modifier and TypeClass and Description
      static interface ExpandingItem.OnItemStateChanged 126 |
      Interface to notify item state changed.
      127 |
      130 |
    • 131 |
    132 | 133 |
      134 |
    • 135 | 136 | 137 |

      Constructor Summary

      138 | 139 | 140 | 141 | 142 | 143 | 144 | 148 | 149 |
      Constructors 
      Constructor and Description
      ExpandingItem(Context context, 145 | AttributeSet attrs) 146 |
      Constructor.
      147 |
      150 |
    • 151 |
    152 | 153 |
      154 |
    • 155 | 156 | 157 |

      Method Summary

      158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 169 | 170 | 171 | 172 | 175 | 176 | 177 | 178 | 181 | 182 | 183 | 184 | 187 | 188 | 189 | 190 | 193 | 194 | 195 | 196 | 199 | 200 | 201 | 202 | 205 | 206 | 207 | 208 | 211 | 212 | 213 | 214 | 217 | 218 | 219 | 220 | 223 | 224 | 225 | 226 | 229 | 230 | 231 | 232 | 235 | 236 | 237 | 238 | 241 | 242 | 243 | 244 | 247 | 248 | 249 | 250 | 253 | 254 | 255 | 256 | 259 | 260 | 261 | 262 | 265 | 266 | 267 | 268 | 271 | 272 |
      Methods 
      Modifier and TypeMethod and Description
      voidcollapse() 167 |
      Collapses the sub items.
      168 |
      ViewcreateSubItem() 173 |
      Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute.
      174 |
      ViewcreateSubItem(int position) 179 |
      Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute.
      180 |
      voidcreateSubItems(int count) 185 |
      Creates as many sub items as requested in .
      186 |
      intgetSubItemsCount() 191 |
      Returns the count of sub items.
      192 |
      ViewgetSubItemView(int position) 197 |
      Get a sub item at the given position.
      198 |
      booleanisExpanded() 203 |
      Tells if the item is expanded.
      204 |
      voidremoveAllSubItems() 209 |
      Remove all sub items.
      210 |
      voidremoveSubItem(View view) 215 |
      Remove the given view representing the sub item, with animation.
      216 |
      voidremoveSubItemAt(int position) 221 |
      Remove sub item at the given position.
      222 |
      voidremoveSubItemFromList(View view) 227 |
      Remove the given view representing the sub item.
      228 |
      voidsetIndicatorColor(int color) 233 |
      Set the indicator color by color value.
      234 |
      voidsetIndicatorColorRes(int colorRes) 239 |
      Set the indicator color by resource.
      240 |
      voidsetIndicatorIcon(Drawable icon) 245 |
      Set the indicator icon.
      246 |
      voidsetIndicatorIconRes(int iconRes) 251 |
      Set the indicator icon by resource.
      252 |
      protected voidsetParent(ExpandingList parent) 257 |
      Set the parent in order to auto scroll.
      258 |
      voidsetStateChangedListener(ExpandingItem.OnItemStateChanged listener) 263 |
      Set a listener to listen item stage changed.
      264 |
      voidtoggleExpanded() 269 |
      Expand or collapse the sub items.
      270 |
      273 |
        274 |
      • 275 | 276 | 277 |

        Methods inherited from class java.lang.Object

        278 | clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • 279 |
      280 |
    • 281 |
    282 |
  • 283 |
284 |
285 |
286 |
    287 |
  • 288 | 289 |
      290 |
    • 291 | 292 | 293 |

      Constructor Detail

      294 | 295 | 296 | 297 |
        298 |
      • 299 |

        ExpandingItem

        300 |
        public ExpandingItem(Context context,
        301 |              AttributeSet attrs)
        302 |
        Constructor.
        303 |
        Parameters:
        context -
        attrs -
        304 |
      • 305 |
      306 |
    • 307 |
    308 | 309 |
      310 |
    • 311 | 312 | 313 |

      Method Detail

      314 | 315 | 316 | 317 | 325 | 326 | 327 | 328 |
        329 |
      • 330 |

        isExpanded

        331 |
        public boolean isExpanded()
        332 |
        Tells if the item is expanded.
        333 |
        Returns:
        true if expanded. false otherwise.
        334 |
      • 335 |
      336 | 337 | 338 | 339 |
        340 |
      • 341 |

        getSubItemsCount

        342 |
        public int getSubItemsCount()
        343 |
        Returns the count of sub items.
        344 |
        Returns:
        The count of sub items.
        345 |
      • 346 |
      347 | 348 | 349 | 350 |
        351 |
      • 352 |

        collapse

        353 |
        public void collapse()
        354 |
        Collapses the sub items.
        355 |
      • 356 |
      357 | 358 | 359 | 360 |
        361 |
      • 362 |

        toggleExpanded

        363 |
        public void toggleExpanded()
        364 |
        Expand or collapse the sub items.
        365 |
      • 366 |
      367 | 368 | 369 | 370 |
        371 |
      • 372 |

        setIndicatorColorRes

        373 |
        public void setIndicatorColorRes(int colorRes)
        374 |
        Set the indicator color by resource.
        375 |
        Parameters:
        colorRes - The color resource.
        376 |
      • 377 |
      378 | 379 | 380 | 381 |
        382 |
      • 383 |

        setIndicatorColor

        384 |
        public void setIndicatorColor(int color)
        385 |
        Set the indicator color by color value.
        386 |
        Parameters:
        color - The color value.
        387 |
      • 388 |
      389 | 390 | 391 | 392 |
        393 |
      • 394 |

        setIndicatorIconRes

        395 |
        public void setIndicatorIconRes(int iconRes)
        396 |
        Set the indicator icon by resource.
        397 |
        Parameters:
        iconRes - The icon resource.
        398 |
      • 399 |
      400 | 401 | 402 | 403 |
        404 |
      • 405 |

        setIndicatorIcon

        406 |
        public void setIndicatorIcon(Drawable icon)
        407 |
        Set the indicator icon.
        408 |
        Parameters:
        icon - Drawable of the indicator icon.
        409 |
      • 410 |
      411 | 412 | 413 | 414 |
        415 |
      • 416 |

        createSubItem

        417 |
        public View createSubItem()
        418 |
        Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute.
        419 |
        Returns:
        The inflated sub item view.
        420 |
      • 421 |
      422 | 423 | 424 | 425 |
        426 |
      • 427 |

        createSubItem

        428 |
        public View createSubItem(int position)
        429 |
        Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute.
        430 |
        Parameters:
        position - The position to add the new Item. Position should not be greater than the list size. 431 | If position is -1, the item will be added in the end of the list.
        432 |
        Returns:
        The inflated sub item view.
        433 |
      • 434 |
      435 | 436 | 437 | 438 |
        439 |
      • 440 |

        createSubItems

        441 |
        public void createSubItems(int count)
        442 |
        Creates as many sub items as requested in .
        443 |
        Parameters:
        count - The quantity of sub items.
        444 |
      • 445 |
      446 | 447 | 448 | 449 |
        450 |
      • 451 |

        getSubItemView

        452 |
        public View getSubItemView(int position)
        453 |
        Get a sub item at the given position.
        454 |
        Parameters:
        position - The sub item position. Should be > 0.
        455 |
        Returns:
        The sub item inflated view at the given position.
        456 |
      • 457 |
      458 | 459 | 460 | 461 |
        462 |
      • 463 |

        removeSubItemAt

        464 |
        public void removeSubItemAt(int position)
        465 |
        Remove sub item at the given position.
        466 |
        Parameters:
        position - The position of the item to be removed.
        467 |
      • 468 |
      469 | 470 | 471 | 472 |
        473 |
      • 474 |

        removeSubItemFromList

        475 |
        public void removeSubItemFromList(View view)
        476 |
        Remove the given view representing the sub item. Should be an existing sub item.
        477 |
        Parameters:
        view - The sub item to be removed.
        478 |
      • 479 |
      480 | 481 | 482 | 483 |
        484 |
      • 485 |

        removeSubItem

        486 |
        public void removeSubItem(View view)
        487 |
        Remove the given view representing the sub item, with animation. Should be an existing sub item.
        488 |
        Parameters:
        view - The sub item to be removed.
        489 |
      • 490 |
      491 | 492 | 493 | 494 |
        495 |
      • 496 |

        removeAllSubItems

        497 |
        public void removeAllSubItems()
        498 |
        Remove all sub items.
        499 |
      • 500 |
      501 | 502 | 503 | 504 |
        505 |
      • 506 |

        setParent

        507 |
        protected void setParent(ExpandingList parent)
        508 |
        Set the parent in order to auto scroll.
        509 |
        Parameters:
        parent - The parent of type ExpandingList
        510 |
      • 511 |
      512 |
    • 513 |
    514 |
  • 515 |
516 |
517 |
518 | 519 | 520 |
521 | 522 | 523 | 524 | 525 | 533 |
534 | 576 | 577 | 578 | 579 | -------------------------------------------------------------------------------- /expanding-view/src/main/java/com/diegodobelo/expandingview/ExpandingItem.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2016, Diego Bezerra 3 | * Permission to use, copy, modify, and/or distribute this software for any purpose 4 | * with or without fee is hereby granted, provided that the above copyright notice 5 | * and this permission notice appear in all copies. 6 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 7 | * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 8 | * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, 9 | * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 10 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 11 | * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 12 | **/ 13 | package com.diegodobelo.expandingview; 14 | 15 | import android.animation.Animator; 16 | import android.animation.AnimatorListenerAdapter; 17 | import android.animation.ValueAnimator; 18 | import android.content.Context; 19 | import android.content.res.TypedArray; 20 | import android.graphics.drawable.Drawable; 21 | import android.graphics.drawable.GradientDrawable; 22 | import android.util.AttributeSet; 23 | import android.view.LayoutInflater; 24 | import android.view.View; 25 | import android.view.ViewGroup; 26 | import android.view.ViewStub; 27 | import android.view.animation.AccelerateDecelerateInterpolator; 28 | import android.widget.ImageView; 29 | import android.widget.LinearLayout; 30 | import android.widget.RelativeLayout; 31 | 32 | import androidx.annotation.Nullable; 33 | import androidx.core.content.ContextCompat; 34 | import utils.CustomViewUtils; 35 | 36 | /** 37 | * Created by diego on 5/5/16. 38 | */ 39 | public class ExpandingItem extends RelativeLayout { 40 | /** 41 | * Constant defining default animation duration in milliseconds. 42 | */ 43 | private static final int DEFAULT_ANIM_DURATION = 300; 44 | 45 | /** 46 | * Member variable to hold the Item Layout. Set by item_layout in ExpandingItem layout. 47 | */ 48 | private ViewGroup mItemLayout; 49 | 50 | /** 51 | * The layout inflater. 52 | */ 53 | private LayoutInflater mInflater; 54 | 55 | /** 56 | * Member variable to hold the base layout. Should not be changed. 57 | */ 58 | private RelativeLayout mBaseLayout; 59 | 60 | /** 61 | * Member variable to hold item. Should not be changed. 62 | */ 63 | private LinearLayout mBaseListLayout; 64 | 65 | /** 66 | * Member variable to hold sub items. Should not be changed. 67 | */ 68 | private LinearLayout mBaseSubListLayout; 69 | 70 | /** 71 | * Member variable to hold the indicator icon. 72 | * Can be set by {@link #setIndicatorIconRes(int)}} or by {@link #setIndicatorIcon(Drawable)}. 73 | */ 74 | private ImageView mIndicatorImage; 75 | 76 | /** 77 | * Member variable to hold the expandable part of indicator. Should not be changed. 78 | */ 79 | private View mIndicatorBackground; 80 | 81 | /** 82 | * Stub to hold separator; 83 | */ 84 | private ViewStub mSeparatorStub; 85 | 86 | /** 87 | * Member variable to hold the indicator container. Should not be changed. 88 | */ 89 | private ViewGroup mIndicatorContainer; 90 | 91 | /** 92 | * Member variable to hold the measured item height. 93 | */ 94 | private int mItemHeight; 95 | 96 | /** 97 | * Member variable to hold the measured sub item height. 98 | */ 99 | private int mSubItemHeight; 100 | 101 | /** 102 | * Member variable to hold the measured sub item width. 103 | */ 104 | private int mSubItemWidth; 105 | 106 | /** 107 | * Member variable to hold the measured total height of sub items. 108 | */ 109 | private int mCurrentSubItemsHeight; 110 | 111 | /** 112 | * Member variable to hold the sub items count. 113 | */ 114 | private int mSubItemCount; 115 | 116 | /** 117 | * Member variable to hold the indicator size. Set by indicator_size in ExpandingItem layout. 118 | */ 119 | private int mIndicatorSize; 120 | 121 | /** 122 | * Member variable to hold the animation duration. 123 | * Set by animation_duration in ExpandingItem layout in milliseconds. 124 | * Default is 300ms. 125 | */ 126 | private int mAnimationDuration; 127 | 128 | /** 129 | * Member variable to hold the indicator margin at left. Set by indicator_margin_left in ExpandingItem layout. 130 | */ 131 | private int mIndicatorMarginLeft; 132 | 133 | /** 134 | * Member variable to hold the indicator margin at right. Set by indicator_margin_right in ExpandingItem layout. 135 | */ 136 | private int mIndicatorMarginRight; 137 | 138 | /** 139 | * Member variable to hold the boolean value that defines if the indicator should be shown. 140 | * Set by show_indicator in ExpandingItem layout. 141 | */ 142 | private boolean mShowIndicator; 143 | 144 | /** 145 | * Member variable to hold the boolean value that defines if the animation should be shown. 146 | * Set by show_animation in ExpandingItem layout. Default is true. 147 | */ 148 | private boolean mShowAnimation; 149 | 150 | /** 151 | * Member variable to hold the boolean value that defines if the sub list will start collapsed or not. 152 | * Set by start_collapsed in ExpandingItem layout. Default is true. 153 | */ 154 | private boolean mStartCollapsed; 155 | 156 | /** 157 | * Member variable to hold the state of sub items. true if shown. false otherwise. 158 | */ 159 | private boolean mSubItemsShown; 160 | 161 | /** 162 | * Member variable to hold the layout resource of sub items. Set by sub_item_layout in ExpandingItem layout. 163 | */ 164 | private int mSubItemLayoutId; 165 | 166 | /** 167 | * Member variable to hold the layout resource of items. Set by item_layout in ExpandingItem layout. 168 | */ 169 | private int mItemLayoutId; 170 | 171 | /** 172 | * Member variable to hold the layout resource of separator. Set by separator_layout in ExpandingItem layout. 173 | */ 174 | private int mSeparatorLayoutId; 175 | 176 | /** 177 | * Holds a reference to the parent. Used to calculate positioning. 178 | */ 179 | private ExpandingList mParent; 180 | 181 | /** 182 | * Member variable to hold the listener of item state change. 183 | */ 184 | private OnItemStateChanged mListener; 185 | 186 | /** 187 | * Constructor. 188 | * @param context 189 | * @param attrs 190 | */ 191 | public ExpandingItem(Context context, AttributeSet attrs) { 192 | super(context, attrs); 193 | 194 | readAttributes(context, attrs); 195 | setupStateVariables(); 196 | inflateLayouts(context); 197 | 198 | setupIndicator(); 199 | 200 | addItem(mItemLayout); 201 | addView(mBaseLayout); 202 | } 203 | 204 | /** 205 | * Setup the variables that defines item state. 206 | */ 207 | private void setupStateVariables() { 208 | if (!mShowAnimation) { 209 | mAnimationDuration = 0; 210 | } 211 | } 212 | 213 | /** 214 | * Method to setup indicator, including size and visibility. 215 | */ 216 | private void setupIndicator() { 217 | if (mIndicatorSize != 0) { 218 | setIndicatorBackgroundSize(); 219 | } 220 | 221 | mIndicatorContainer.setVisibility(mShowIndicator && mIndicatorSize != 0 ? VISIBLE : GONE); 222 | } 223 | 224 | /** 225 | * Read all custom styleable attributes. 226 | * @param context The custom View Context. 227 | * @param attrs The atrributes to be read. 228 | */ 229 | private void readAttributes(Context context, AttributeSet attrs) { 230 | TypedArray array = context.getTheme().obtainStyledAttributes(attrs, 231 | R.styleable.ExpandingItem, 0, 0); 232 | 233 | try { 234 | mItemLayoutId = array.getResourceId(R.styleable.ExpandingItem_item_layout, 0); 235 | mSeparatorLayoutId = array.getResourceId(R.styleable.ExpandingItem_separator_layout, 0); 236 | mSubItemLayoutId = array.getResourceId(R.styleable.ExpandingItem_sub_item_layout, 0); 237 | mIndicatorSize = array.getDimensionPixelSize(R.styleable.ExpandingItem_indicator_size, 0); 238 | mIndicatorMarginLeft = array.getDimensionPixelSize(R.styleable.ExpandingItem_indicator_margin_left, 0); 239 | mIndicatorMarginRight = array.getDimensionPixelSize(R.styleable.ExpandingItem_indicator_margin_right, 0); 240 | mShowIndicator = array.getBoolean(R.styleable.ExpandingItem_show_indicator, true); 241 | mShowAnimation = array.getBoolean(R.styleable.ExpandingItem_show_animation, true); 242 | mStartCollapsed = array.getBoolean(R.styleable.ExpandingItem_start_collapsed, true); 243 | mAnimationDuration = array.getInt(R.styleable.ExpandingItem_animation_duration, DEFAULT_ANIM_DURATION); 244 | } finally { 245 | array.recycle(); 246 | } 247 | } 248 | 249 | /** 250 | * Method to inflate all layouts. 251 | * @param context The custom View Context. 252 | */ 253 | private void inflateLayouts(Context context) { 254 | mInflater = LayoutInflater.from(context); 255 | mBaseLayout = (RelativeLayout) mInflater.inflate(R.layout.expanding_item_base_layout, 256 | null, false); 257 | mBaseListLayout = mBaseLayout.findViewById(R.id.base_list_layout); 258 | mBaseSubListLayout = mBaseLayout.findViewById(R.id.base_sub_list_layout); 259 | mIndicatorImage = mBaseLayout.findViewById(R.id.indicator_image); 260 | mBaseLayout.findViewById(R.id.icon_indicator_top).bringToFront(); 261 | mSeparatorStub = mBaseLayout.findViewById(R.id.base_separator_stub); 262 | mIndicatorBackground = mBaseLayout.findViewById(R.id.icon_indicator_middle); 263 | mIndicatorContainer = mBaseLayout.findViewById(R.id.indicator_container); 264 | mIndicatorContainer.setOnClickListener(new OnClickListener() { 265 | @Override 266 | public void onClick(View v) { 267 | toggleExpanded(); 268 | } 269 | }); 270 | 271 | if (mItemLayoutId != 0) { 272 | mItemLayout = (ViewGroup) mInflater.inflate(mItemLayoutId, mBaseLayout, false); 273 | } 274 | if (mSeparatorLayoutId != 0) { 275 | mSeparatorStub.setLayoutResource(mSeparatorLayoutId); 276 | mSeparatorStub.inflate(); 277 | } 278 | } 279 | 280 | /** 281 | * Set the indicator background width, height and margins 282 | */ 283 | private void setIndicatorBackgroundSize() { 284 | CustomViewUtils.setViewHeight(mBaseLayout.findViewById(R.id.icon_indicator_top), mIndicatorSize); 285 | CustomViewUtils.setViewHeight(mBaseLayout.findViewById(R.id.icon_indicator_bottom), mIndicatorSize); 286 | CustomViewUtils.setViewHeight(mBaseLayout.findViewById(R.id.icon_indicator_middle), 0); 287 | 288 | CustomViewUtils.setViewWidth(mBaseLayout.findViewById(R.id.icon_indicator_top), mIndicatorSize); 289 | CustomViewUtils.setViewWidth(mBaseLayout.findViewById(R.id.icon_indicator_bottom), mIndicatorSize); 290 | CustomViewUtils.setViewWidth(mBaseLayout.findViewById(R.id.icon_indicator_middle), mIndicatorSize); 291 | 292 | mItemLayout.post(new Runnable() { 293 | @Override 294 | public void run() { 295 | CustomViewUtils.setViewMargin(mIndicatorContainer, 296 | mIndicatorMarginLeft, mItemLayout.getMeasuredHeight() / 2 - mIndicatorSize / 2, mIndicatorMarginRight, 0); 297 | } 298 | }); 299 | 300 | CustomViewUtils.setViewMarginTop(mBaseLayout.findViewById(R.id.icon_indicator_middle), (-1 * mIndicatorSize / 2)); 301 | CustomViewUtils.setViewMarginTop(mBaseLayout.findViewById(R.id.icon_indicator_bottom), (-1 * mIndicatorSize / 2)); 302 | 303 | } 304 | 305 | /** 306 | * Set a listener to listen item stage changed. 307 | * @param listener The listener of type {@link OnItemStateChanged} 308 | */ 309 | public void setStateChangedListener(OnItemStateChanged listener) { 310 | mListener = listener; 311 | } 312 | 313 | /** 314 | * Tells if the item is expanded. 315 | * @return true if expanded. false otherwise. 316 | */ 317 | public boolean isExpanded() { 318 | return mSubItemsShown; 319 | } 320 | 321 | /** 322 | * Returns the count of sub items. 323 | * @return The count of sub items. 324 | */ 325 | public int getSubItemsCount() { 326 | return mSubItemCount; 327 | } 328 | 329 | /** 330 | * Collapses the sub items. 331 | */ 332 | public void collapse() { 333 | mSubItemsShown = false; 334 | mBaseSubListLayout.post(new Runnable() { 335 | @Override 336 | public void run() { 337 | CustomViewUtils.setViewHeight(mBaseSubListLayout, 0); 338 | } 339 | }); 340 | } 341 | 342 | /** 343 | * Expand or collapse the sub items. 344 | */ 345 | public void toggleExpanded() { 346 | if (mSubItemCount == 0) { 347 | return; 348 | } 349 | 350 | if (!mSubItemsShown) { 351 | adjustItemPosIfHidden(); 352 | } 353 | 354 | toggleSubItems(); 355 | expandSubItemsWithAnimation(0f); 356 | expandIconIndicator(0f); 357 | animateSubItemsIn(); 358 | } 359 | 360 | /** 361 | * Method to adjust Item position in parent if its sub items are outside screen. 362 | */ 363 | private void adjustItemPosIfHidden() { 364 | int parentHeight = mParent.getMeasuredHeight(); 365 | int[] parentPos = new int[2]; 366 | mParent.getLocationOnScreen(parentPos); 367 | int parentY = parentPos[1]; 368 | int[] itemPos = new int[2]; 369 | mBaseLayout.getLocationOnScreen(itemPos); 370 | int itemY = itemPos[1]; 371 | 372 | 373 | int endPosition = itemY + mItemHeight + (mSubItemHeight * mSubItemCount); 374 | int parentEnd = parentY + parentHeight; 375 | if (endPosition > parentEnd) { 376 | int delta = endPosition - parentEnd; 377 | int itemDeltaToTop = itemY - parentY; 378 | if (delta > itemDeltaToTop) { 379 | delta = itemDeltaToTop; 380 | } 381 | mParent.scrollUpByDelta(delta); 382 | } 383 | } 384 | 385 | /** 386 | * Set the indicator color by resource. 387 | * @param colorRes The color resource. 388 | */ 389 | public void setIndicatorColorRes(int colorRes) { 390 | setIndicatorColor(ContextCompat.getColor(getContext(), colorRes)); 391 | } 392 | 393 | /** 394 | * Set the indicator color by color value. 395 | * @param color The color value. 396 | */ 397 | public void setIndicatorColor(int color) { 398 | ((GradientDrawable) findViewById(R.id.icon_indicator_top).getBackground().mutate()).setColor(color); 399 | ((GradientDrawable) findViewById(R.id.icon_indicator_bottom).getBackground().mutate()).setColor(color); 400 | findViewById(R.id.icon_indicator_middle).setBackgroundColor(color); 401 | } 402 | 403 | /** 404 | * Set the indicator icon by resource. 405 | * @param iconRes The icon resource. 406 | */ 407 | public void setIndicatorIconRes(int iconRes) { 408 | setIndicatorIcon(ContextCompat.getDrawable(getContext(), iconRes)); 409 | } 410 | 411 | /** 412 | * Set the indicator icon. 413 | * @param icon Drawable of the indicator icon. 414 | */ 415 | public void setIndicatorIcon(Drawable icon) { 416 | mIndicatorImage.setImageDrawable(icon); 417 | } 418 | 419 | /** 420 | * Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute. 421 | * @return The inflated sub item view. 422 | */ 423 | @Nullable 424 | public View createSubItem() { 425 | return createSubItem(-1); 426 | } 427 | 428 | /** 429 | * Creates a sub item based on sub_item_layout Layout, set as ExpandingItem layout attribute. 430 | * @param position The position to add the new Item. Position should not be greater than the list size. 431 | * If position is -1, the item will be added in the end of the list. 432 | * @return The inflated sub item view. 433 | */ 434 | @Nullable 435 | public View createSubItem(int position) { 436 | if (mSubItemLayoutId == 0) { 437 | throw new RuntimeException("There is no layout to be inflated. " + 438 | "Please set sub_item_layout value"); 439 | } 440 | 441 | if (position > mBaseSubListLayout.getChildCount()) { 442 | throw new IllegalArgumentException("Cannot add an item at position " + position + 443 | ". List size is " + mBaseSubListLayout.getChildCount()); 444 | } 445 | 446 | ViewGroup subItemLayout = (ViewGroup) mInflater.inflate(mSubItemLayoutId, mBaseSubListLayout, false); 447 | if (position == -1) { 448 | mBaseSubListLayout.addView(subItemLayout); 449 | } else { 450 | mBaseSubListLayout.addView(subItemLayout, position); 451 | } 452 | mSubItemCount++; 453 | setSubItemDimensions(subItemLayout); 454 | 455 | //Animate sub view in 456 | if (mSubItemsShown) { 457 | CustomViewUtils.setViewHeight(subItemLayout, 0); 458 | expandSubItemsWithAnimation(mSubItemHeight * (mSubItemCount)); 459 | expandIconIndicator(mCurrentSubItemsHeight); 460 | animateSubItemAppearance(subItemLayout, true); 461 | adjustItemPosIfHidden(); 462 | } 463 | 464 | return subItemLayout; 465 | } 466 | 467 | /** 468 | * Creates as many sub items as requested in {@param count}. 469 | * @param count The quantity of sub items. 470 | */ 471 | public void createSubItems(int count) { 472 | if (mSubItemLayoutId == 0) { 473 | throw new RuntimeException("There is no layout to be inflated. " + 474 | "Please set sub_item_layout value"); 475 | } 476 | for (int i = 0; i < count; i++) { 477 | createSubItem(); 478 | } 479 | if (mStartCollapsed) { 480 | collapse(); 481 | } else { 482 | mSubItemsShown = true; 483 | mBaseSubListLayout.post(new Runnable() { 484 | @Override 485 | public void run() { 486 | expandIconIndicator(0f); 487 | } 488 | }); 489 | } 490 | } 491 | 492 | /** 493 | * Get a sub item at the given position. 494 | * @param position The sub item position. Should be > 0. 495 | * @return The sub item inflated view at the given position. 496 | */ 497 | public View getSubItemView(int position) { 498 | if (mBaseSubListLayout.getChildAt(position) != null) { 499 | return mBaseSubListLayout.getChildAt(position); 500 | } 501 | throw new RuntimeException("There is no sub item for position " + position + 502 | ". There are only " + mBaseSubListLayout.getChildCount() + " in the list."); 503 | } 504 | 505 | /** 506 | * Remove sub item at the given position. 507 | * @param position The position of the item to be removed. 508 | */ 509 | public void removeSubItemAt(int position) { 510 | removeSubItemFromList(mBaseSubListLayout.getChildAt(position)); 511 | } 512 | 513 | /** 514 | * Remove the given view representing the sub item. Should be an existing sub item. 515 | * @param view The sub item to be removed. 516 | */ 517 | public void removeSubItemFromList(View view) { 518 | if (view != null) { 519 | mBaseSubListLayout.removeView(view); 520 | mSubItemCount--; 521 | expandSubItemsWithAnimation(mSubItemHeight * (mSubItemCount + 1)); 522 | if (mSubItemCount == 0) { 523 | mCurrentSubItemsHeight = 0; 524 | mSubItemsShown = false; 525 | } 526 | expandIconIndicator(mCurrentSubItemsHeight); 527 | } 528 | } 529 | 530 | /** 531 | * Remove the given view representing the sub item, with animation. Should be an existing sub item. 532 | * @param view The sub item to be removed. 533 | */ 534 | public void removeSubItem(View view) { 535 | animateSubItemAppearance(view, false); 536 | } 537 | 538 | /** 539 | * Remove all sub items. 540 | */ 541 | public void removeAllSubItems() { 542 | mBaseSubListLayout.removeAllViews(); 543 | } 544 | 545 | /** 546 | * Set the parent in order to auto scroll. 547 | * @param parent The parent of type {@link ExpandingList} 548 | */ 549 | protected void setParent(ExpandingList parent) { 550 | mParent = parent; 551 | } 552 | 553 | /** 554 | * Method to add the inflated item and set click listener. 555 | * Also measures the item height. 556 | * @param item The inflated item layout. 557 | */ 558 | private void addItem(final ViewGroup item) { 559 | if (item != null) { 560 | mBaseListLayout.addView(item); 561 | item.setOnClickListener(new OnClickListener() { 562 | @Override 563 | public void onClick(View v) { 564 | toggleExpanded(); 565 | } 566 | }); 567 | item.post(new Runnable() { 568 | @Override 569 | public void run() { 570 | mItemHeight = item.getMeasuredHeight(); 571 | } 572 | }); 573 | } 574 | } 575 | 576 | /** 577 | * Measure sub items dimension. 578 | * @param v The sub item to measure. 579 | */ 580 | private void setSubItemDimensions(final ViewGroup v) { 581 | v.post(new Runnable() { 582 | @Override 583 | public void run() { 584 | if (mSubItemHeight <= 0) { 585 | mSubItemHeight = v.getMeasuredHeight(); 586 | mSubItemWidth = v.getMeasuredWidth(); 587 | } 588 | } 589 | }); 590 | } 591 | 592 | /** 593 | * Toggle sub items collapsed/expanded 594 | */ 595 | private void toggleSubItems() { 596 | mSubItemsShown = !mSubItemsShown; 597 | if (mListener != null) { 598 | mListener.itemCollapseStateChanged(mSubItemsShown); 599 | } 600 | } 601 | 602 | /** 603 | * Show sub items animation. 604 | */ 605 | private void animateSubItemsIn() { 606 | for (int i = 0; i < mSubItemCount; i++) { 607 | animateSubViews((ViewGroup) mBaseSubListLayout.getChildAt(i), i); 608 | animateViewAlpha((ViewGroup) mBaseSubListLayout.getChildAt(i), i); 609 | } 610 | } 611 | 612 | /** 613 | * Show sub items translation animation. 614 | * @param viewGroup The sub item to animate 615 | * @param index The sub item index. Needed to calculate delays. 616 | */ 617 | private void animateSubViews(final ViewGroup viewGroup, int index) { 618 | if (viewGroup == null) { 619 | return; 620 | } 621 | viewGroup.setLayerType(ViewGroup.LAYER_TYPE_HARDWARE, null); 622 | ValueAnimator animation = mSubItemsShown ? 623 | ValueAnimator.ofFloat(0f, 1f) : 624 | ValueAnimator.ofFloat(1f, 0f); 625 | animation.setDuration(mAnimationDuration); 626 | int delay = index * mAnimationDuration / mSubItemCount; 627 | int invertedDelay = (mSubItemCount - index) * mAnimationDuration / mSubItemCount; 628 | animation.setStartDelay(mSubItemsShown ? delay / 2 : invertedDelay / 2); 629 | 630 | animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 631 | @Override 632 | public void onAnimationUpdate(ValueAnimator animation) { 633 | float val = (float) animation.getAnimatedValue(); 634 | viewGroup.setX((mSubItemWidth / 2 * val) - mSubItemWidth / 2); 635 | } 636 | }); 637 | 638 | animation.addListener(new AnimatorListenerAdapter() { 639 | @Override 640 | public void onAnimationEnd(Animator animation) { 641 | viewGroup.setLayerType(ViewGroup.LAYER_TYPE_NONE, null); 642 | } 643 | }); 644 | 645 | animation.start(); 646 | } 647 | 648 | /** 649 | * Show sub items alpha animation. 650 | * @param viewGroup The sub item to animate 651 | * @param index The sub item index. Needed to calculate delays. 652 | */ 653 | private void animateViewAlpha(final ViewGroup viewGroup, int index) { 654 | if (viewGroup == null) { 655 | return; 656 | } 657 | ValueAnimator animation = mSubItemsShown ? 658 | ValueAnimator.ofFloat(0f, 1f) : 659 | ValueAnimator.ofFloat(1f, 0f); 660 | animation.setDuration(mSubItemsShown ? mAnimationDuration * 2 : mAnimationDuration); 661 | int delay = index * mAnimationDuration / mSubItemCount; 662 | animation.setStartDelay(mSubItemsShown ? delay / 2 : 0); 663 | 664 | animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 665 | @Override 666 | public void onAnimationUpdate(ValueAnimator animation) { 667 | float val = (float) animation.getAnimatedValue(); 668 | viewGroup.setAlpha(val); 669 | } 670 | }); 671 | 672 | animation.start(); 673 | } 674 | 675 | /** 676 | * Show indicator animation. 677 | * @param startingPos The position from where the animation should start. Useful when removing sub items. 678 | */ 679 | private void expandIconIndicator(float startingPos) { 680 | if (mIndicatorBackground != null) { 681 | final int totalHeight = (mSubItemHeight * mSubItemCount) - mIndicatorSize / 2 + mItemHeight / 2; 682 | mCurrentSubItemsHeight = totalHeight; 683 | ValueAnimator animation = mSubItemsShown ? 684 | ValueAnimator.ofFloat(startingPos, totalHeight) : 685 | ValueAnimator.ofFloat(totalHeight, startingPos); 686 | animation.setInterpolator(new AccelerateDecelerateInterpolator()); 687 | animation.setDuration(mAnimationDuration); 688 | animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 689 | @Override 690 | public void onAnimationUpdate(ValueAnimator animation) { 691 | float val = (float) animation.getAnimatedValue(); 692 | CustomViewUtils.setViewHeight(mIndicatorBackground, (int) val); 693 | } 694 | }); 695 | 696 | animation.start(); 697 | } 698 | } 699 | 700 | /** 701 | * Expand the sub items container with animation 702 | * @param startingPos The position from where the animation should start. Useful when removing sub items. 703 | */ 704 | private void expandSubItemsWithAnimation(float startingPos) { 705 | if (mBaseSubListLayout != null) { 706 | final int totalHeight = (mSubItemHeight * mSubItemCount); 707 | ValueAnimator animation = mSubItemsShown ? 708 | ValueAnimator.ofFloat(startingPos, totalHeight) : 709 | ValueAnimator.ofFloat(totalHeight, startingPos); 710 | animation.setInterpolator(new AccelerateDecelerateInterpolator()); 711 | animation.setDuration(mAnimationDuration); 712 | 713 | animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 714 | @Override 715 | public void onAnimationUpdate(ValueAnimator animation) { 716 | float val = (float) animation.getAnimatedValue(); 717 | CustomViewUtils.setViewHeight(mBaseSubListLayout, (int) val); 718 | } 719 | }); 720 | 721 | animation.addListener(new AnimatorListenerAdapter() { 722 | @Override 723 | public void onAnimationEnd(Animator animation) { 724 | super.onAnimationEnd(animation); 725 | if (mSubItemsShown) { 726 | adjustItemPosIfHidden(); 727 | } 728 | } 729 | }); 730 | 731 | animation.start(); 732 | } 733 | } 734 | 735 | /** 736 | * Remove the given sub item after animation ends. 737 | * @param subItem The view representing the sub item to be removed. 738 | * @param isAdding true if adding a view. false otherwise. 739 | */ 740 | private void animateSubItemAppearance(final View subItem, boolean isAdding) { 741 | ValueAnimator alphaAnimation = isAdding ? 742 | ValueAnimator.ofFloat(0f, 1f) : ValueAnimator.ofFloat(1f, 0f); 743 | alphaAnimation.setDuration(isAdding ? mAnimationDuration * 2 : mAnimationDuration / 2); 744 | 745 | ValueAnimator heightAnimation = isAdding ? 746 | ValueAnimator.ofFloat(0f, mSubItemHeight) : ValueAnimator.ofFloat(mSubItemHeight, 0f); 747 | heightAnimation.setDuration(mAnimationDuration / 2); 748 | heightAnimation.setStartDelay(mAnimationDuration / 2); 749 | 750 | alphaAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 751 | @Override 752 | public void onAnimationUpdate(ValueAnimator animation) { 753 | float val = (float) animation.getAnimatedValue(); 754 | subItem.setAlpha(val); 755 | } 756 | }); 757 | 758 | heightAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { 759 | @Override 760 | public void onAnimationUpdate(ValueAnimator animation) { 761 | float val = (float) animation.getAnimatedValue(); 762 | CustomViewUtils.setViewHeight(subItem, (int) val); 763 | } 764 | }); 765 | 766 | alphaAnimation.start(); 767 | heightAnimation.start(); 768 | 769 | if (!isAdding) { 770 | heightAnimation.addListener(new AnimatorListenerAdapter() { 771 | @Override 772 | public void onAnimationEnd(Animator animation) { 773 | super.onAnimationEnd(animation); 774 | removeSubItemFromList(subItem); 775 | } 776 | }); 777 | } 778 | } 779 | 780 | /** 781 | * Interface to notify item state changed. 782 | */ 783 | public interface OnItemStateChanged { 784 | /** 785 | * Notify if item was expanded or collapsed. 786 | * @param expanded true if expanded. false otherwise. 787 | */ 788 | void itemCollapseStateChanged(boolean expanded); 789 | } 790 | 791 | } 792 | --------------------------------------------------------------------------------