Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open swipe layout. #4

Open
ghost opened this issue Aug 3, 2016 · 5 comments
Open

Open swipe layout. #4

ghost opened this issue Aug 3, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Aug 3, 2016

Hi, Is any possibility to open swipe layout? Swipe it to max clamp offset.
It is very useful in lists. I can save swipe layout state and restore it on onBindViewHolder func. Now I found only method to close swipe layout.

public void reset() {
        if (centerView == null) return;

        finishResetAnimator();
        dragHelper.abort();

        offsetChildren(null, -centerView.getLeft());
    }

Thanks.

@EdSergeev
Copy link
Collaborator

hi, thanks for your suggestion, i'll try add this feature.
For now, you can get current offset by calling getOffset() and restore it by setOffset()

@Monikataware
Copy link

Hi, Is any possibility to open swipe layout?

@andrei-costeiu
Copy link

andrei-costeiu commented May 29, 2017

to open swipe layout:

SwipeLayout swipeLayout = (SwipeLayout) findViewById(R.id.swipeLayout);

ObjectAnimator animator = new ObjectAnimator();
animator.setTarget(swipeLayout);
animator.setPropertyName("offset");
animator.setInterpolator(new LinearInterpolator());//default: AccelerateInterpolator
animator.setIntValues(-swipeLayout.getWidth());
animator.setDuration(150);// default 200
animator.start();

@aitbaali
Copy link

aitbaali commented Jun 1, 2017

@andrei-costeiu your solution is not working for me:
`<ru.rambler.libs.swipe_layout.SwipeLayout
android:id="@+id/swipe2"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:left_swipe_enabled="true">

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/black">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/md_grey_100"
        app:gravity="right">

        <EditText
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </LinearLayout>
</ru.rambler.libs.swipe_layout.SwipeLayout>`

@HE-LU
Copy link

HE-LU commented Oct 11, 2019

Hey. We are using our library on our project, and I think that this missing API for opening(sliding) the view programmatically is real bummer. Would be great to see it in the next version. I bet that writing those methods would take you just few minutes. Please, do it for us! 💪 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants