Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
v1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent Champigny committed Apr 16, 2020
1 parent 6accce4 commit 22ade1a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 32 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
3 changes: 3 additions & 0 deletions .idea/modules.xml

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

60 changes: 29 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,6 @@ https://material.io/archive/guidelines/components/expansion-panels.html#

[![screen](https://raw.githubusercontent.com/florent37/ExpansionPanel/master/medias/video1.gif)](https://www.github.com/florent37/ExpansionPanel)


# Differences from master

Update gradle, add ability to have only one listener at time

(For what? If you tried to debug ViewHolders with this layout, then you might notice that over time addListener continues to add a listener, which causes a lot of unnecessary listeners and, moreover, there can be many listeners to one layouts in different ViewHolders due to which it may cause logic breakdown)

```
//Kotlin
var isExpanded = false
expandableLayout.run {
//expandableLayout.singleListener = true
singleListener = true
expandableLayout.addListener { expansionLayout, expanded ->
isExpanded = expanded
}
//do not toggle (expand/collapse, etc) before add listener
if (isExpanded)
expand(false)
else
collapse(false)
}
```

If you want use this version, you should make AAR (google)

# Download

<a href='https://ko-fi.com/A160LCC' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
Expand Down Expand Up @@ -199,6 +168,35 @@ public class MyRecyclerAdapter extends RecyclerView.Adapter<MyRecyclerHolder> {
}
```

# Single Listener

Update gradle, add ability to have only one listener at time

For what? If you tried to debug ViewHolders with this layout,
then you might notice that over time addListener continues to add a listener,
which causes a lot of unnecessary listeners and, moreover,
there can be many listeners to one layouts in different ViewHolders due to which it may cause logic breakdown

```kotlin
var isExpanded = false

expandableLayout.run {
//expandableLayout.singleListener = true
singleListener = true

expandableLayout.addListener { expansionLayout, expanded ->
isExpanded = expanded
}

//do not toggle (expand/collapse, etc) before add listener

if (isExpanded)
expand(false)
else
collapse(false)
}
```

# Credits

Author: Florent Champigny [http://www.florentchampigny.com/](http://www.florentchampigny.com/)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ext {
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
targetCompatibilityVersion = JavaVersion.VERSION_1_7
supportVersion = '27.0.2'
libraryVersion = '1.2.1'
libraryVersion = '1.2.2'
butterknife = '9.0.0-SNAPSHOT'
}

0 comments on commit 22ade1a

Please sign in to comment.