daimajia / daimajia/AndroidSwipeLayout

nested SwipeLayouts

Open
#71 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.3k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Hi, I have few SwipeLayouts inside another one something like this:

``` xml








```

By default I would like to make my `common` layout be swipable, Layouts `2` and `3` invisible and layouts `1` and `4` clickable. When user click `1` or `4` it opens hidden layouts and make `1 - 4` swipable and disable swipe for `common`. When `1 - 4` are opened click on them should hide `2 - 3`.

It works well with click listeners and toggling swipability with `setSwipeEnabled()`. But user can not swipe `common` moving finger on top of `1` or `4` when whey are setted to setSwipeEnabled(false).
It swipes only if user swipe on `text` for example or somewhere else outside `LinearLayout`.

Here is a simplified version of my code:

``` Java
boolean isCollapsed = true;

OnClickListener clickListener = (v) -> {
setSwipeChildren(!isCollapsed);
hideChildren(isColapsed);
isCollapsed = !isCollapsed;
}

private void setSwipeChildren(boolean b) {
common.setSwipeEnabled(!b);
for (int i = 0; i < linearLayout.getChildCount(); ++i) {
try {
((SwipeLayout)daysLayout.getChildAt(i)).setSwipeEnabled(b);
} catch (Throwable t) {}
}
}

private void hideChildren(boolean b) {
for (int i = 1; i < linearLayout.getChildCount() - 1; ++i) {
try {
((SwipeLayout)daysLayout.getChildAt(i)).setVisibility( b ? View.GONE : View.Visible );
} catch (Throwable t) {}
}
}
```

Can you help me to make `1` an `4` move `common` if they are disabled for swipe ?

So basically I need to handle tap in `1` and `4` but move/swipe in `common`.

Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.