Skip to content

Commit

Permalink
Resolved #357 - Allow usage of Parcelable for IHeaders and IFlexible
Browse files Browse the repository at this point in the history
If you pass the Items or Headers to an Intent as a Parcelable the headers
are recreated as different instances and are shown above each item and not
the whole group. The reason for this of the usage of reference equality
check. We need to use the equal() to fix this issue.

(cherry picked from commit 61a58e0)
  • Loading branch information
long1eu authored and davideas committed May 9, 2017
1 parent 658a514 commit 8c85ae1
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ private void showAllHeadersWithReset(boolean init) {
T item = mItems.get(position);
// Reset hidden status! Necessary after the filter and the update
IHeader header = getHeaderOf(item);
if (header != sameHeader && header != null && !isExpandable((T) header)) {
if (!header.equals(sameHeader) && header != null && !isExpandable((T) header)) {
sameHeader = header;
header.setHidden(true);
}
Expand Down Expand Up @@ -4219,7 +4219,7 @@ private void resetFilterFlags(List<T> items) {
// Restore headers visibility
if (headersShown) {
IHeader header = getHeaderOf(item);
if (header != sameHeader && header != null && !isExpandable((T) header)) {
if (!header.equals(sameHeader) && header != null && !isExpandable((T) header)) {
header.setHidden(false);
sameHeader = header;
items.add(i, (T) header);
Expand Down Expand Up @@ -5502,7 +5502,7 @@ private void prepareItemsForUpdate(List<T> newItems) {
headersShown = true;
}
IHeader header = getHeaderOf(item);
if (header != sameHeader && header != null && !isExpandable((T) header)) {
if (header.equals(sameHeader) && header != null && !isExpandable((T) header)) {
header.setHidden(false);
sameHeader = header;
newItems.add(position, (T) header);
Expand Down

0 comments on commit 8c85ae1

Please sign in to comment.