The Most Powerful Swipe Layout!

Overview

Android Swipe Layout Build Status

![Gitter](https://badges.gitter.im/Join Chat.svg)

Insight.io

This is the brother of AndroidViewHover.

One year ago, I started to make an app named EverMemo with my good friends. The designer gave me a design picture, the design like this:

I found it was pretty hard to achieve this effect, cause you had to be very familiar with the Android Touch System. It was beyond my ability that moment, and I also noticed that there was no such a concept library...

Time passed, finally...as you see right now.

Demo

Download Demo

Before I made this, I actually found some libraries (eg.SwipeListView) that helps developers to integrate swiping with your UI component.

But it only works in ListView, and it has too many issues that they never care. What a pity!

When I start to make this library, I set some goals:

  • Can be easily integrated in anywhere, ListView, GridView, ViewGroup etc.
  • Can receive onOpen,onClose,onUpdate callbacks.
  • Can notifiy the hidden children how much they have shown.
  • Can be nested each other.
  • Can handle complicate situation, just like this.

Usage

Step 1

Gradle

dependencies {
    compile 'com.android.support:recyclerview-v7:21.0.0'
    compile 'com.android.support:support-v4:20.+'
    compile "com.daimajia.swipelayout:library:1.2.0@aar"
}

Maven

<dependency>
	<groupId>com.google.android</groupId>
	<artifactId>support-v4</artifactId>
	<version>r6</version>
</dependency>
<dependency>
	<groupId>com.google.android</groupId>
	<artifactId>recyclerview-v7</artifactId>
	<version>21.0.0</version>
</dependency>
<dependency>
    <groupId>com.daimajia.swipelayout</groupId>
    <artifactId>library</artifactId>
    <version>1.2.0</version>
    <type>apklib</type>
</dependency>

Eclipse

AndroidSwipeLayout-v1.1.8.jar

Step 2

Make sure to use the internal adapter instead of your own!

Wiki Usage

Wiki

Go to Wiki

About me

A student in mainland China.

Welcome to offer me an internship. If you have any new idea about this project, feel free to contact me. 😃

Comments
  • SeekBar inside the SurfaceView

    SeekBar inside the SurfaceView

    Hello,

    I would like to put a SeekBar inside the top view of a SwipeLayout but it doesn't work well. I can't drag the cursor properly because the SwipeLayout is taking the touch event. It only work if i do tiny move (not enough to trigger the swipe i suppose). [ Edit: i was just taping next to the cursor]

    Is there a way to resolve this ?

    Thanks

    bug 
    opened by ClementHard 24
  • Create recycler adapter and example

    Create recycler adapter and example

    Fix for #49

    1. Created an advanced RecyclerAdapter in the Demo to instruct people on how to use the RecyclerView.Adapter straight from the android sdk.
    2. Created a simplified RecyclerAdapter in the Demo that extends from a newly created RecyclerSwipeAdapter that was created in the library.
    3. Created a RecyclerViewExample activity to demonstrate the simplifies approach as well as using TwoWayView library with RecyclerView.
    4. Update Library components concerning the RecyclerView and pulled the Mode attribute out to a util package.
    opened by jpshelley 23
  • generateView int position is always 0

    generateView int position is always 0

    Why the position is always 0 when generateView is called? I want to make a listview and i hold a reference to a list with all the objects in the swipeadapter. I have a trash imageview in the bottom view (just like in the tutorial) which when clicked it deletes that item, but i can't notify the adapter with the position since it's always 0. So the wrong item gets deleted.

    help wanted 
    opened by vaggelis-net 23
  • drag not working properly on 1.2.0

    drag not working properly on 1.2.0

    Hi

    I have just updated the library to the version 1.2.0

    I noticed that the drag is set to left AND right even if I have only add the left one:

    SwipeLayout swipeLayout = (SwipeLayout) v.findViewById(R.id.swipeLayout);
    swipeLayout.setShowMode(SwipeLayout.ShowMode.PullOut);
    swipeLayout.addDrag(SwipeLayout.DragEdge.Left, v.findViewById(R.id.bottomView));
    

    Did I missed something?

    S.

    opened by eloudsa 16
  • Refactor the touch logic and usage.

    Refactor the touch logic and usage.

    1.The surface and bottom view could be clickable and longClickable, and it's selector drawables works fine; 2.The swipeLayout can wrap in other gestural layout, the swipe and other layout's gesture work's pretty;

    opened by linfaxin 16
  • remove an listview item in swipeadater?

    remove an listview item in swipeadater?

    I have a horizontal list view and for each item I want to delete it with swipe gesture. I put the delete logic in onOpen method, but seems it's not working.

    @Override
                public void onOpen(SwipeLayout layout) {
                     //when the BottomView totally show.
                    Log.d("Position", Integer.toString(position));
    
                    mPictures.remove(position);
                    notifyDataSetChanged();
    
                }
    
    opened by huchunyu 16
  • cannot resolve methods setDragEdges and setBottomViewIds.

    cannot resolve methods setDragEdges and setBottomViewIds.

    I have used the new compile statement compile "com.daimajia.swipelayout:library:1.1.8@aar" But i get the following error: cannot Resolve method setDragEdges and setBottomViewIds and Also the same for SwipeLayout.EMPTY_LAYOUT.

    Following is image Describing the Problem swipe

    opened by iAviatorJose 15
  • Caused by: java.lang.NoClassDefFoundError: com.daimajia.swipe.SwipeLayout$1

    Caused by: java.lang.NoClassDefFoundError: com.daimajia.swipe.SwipeLayout$1

    i'm have trouble using AndroidSwipeLayout, the problem are the same as this one https://groups.google.com/forum/#!topic/ruboto/J--QmJPnMos

    i don't know is this the bug in android studio or your library.

    thanks !

    help wanted 
    opened by fenjuly 12
  • Add Contributing Documentation

    Add Contributing Documentation

    @daimajia we should consider adding a doc called CONTRIBUTING. As mentioned by github guidelines: https://guides.github.com/activities/contributing-to-open-source/ It can be rather simple but thought I'd keep an issue open until one is created.

    opened by jpshelley 11
  • swipeLayout.close() does nothing

    swipeLayout.close() does nothing

    Hi,

    When I am calling the method close() in a SwipeListener() nothing happen.

    Here is a sample code :

                mSwipeLayout.addDrag(SwipeLayout.DragEdge.Right, mHideSwipeView);
                mSwipeLayout.setClickToClose(true);
                mSwipeLayout.addSwipeListener(new SwipeLayout.SwipeListener() {
                    @Override
                    public void onStartOpen(SwipeLayout swipeLayout) {
    
                    }
    
                    @Override
                    public void onOpen(SwipeLayout swipeLayout) {
                    }
    
                    @Override
                    public void onStartClose(SwipeLayout swipeLayout) {
    
                    }
    
                    @Override
                    public void onClose(SwipeLayout swipeLayout) {
    
                    }
    
                    @Override
                    public void onUpdate(SwipeLayout swipeLayout, int leftOffset, int rightOffset) {
    
                    }
    
                    @Override
                    public void onHandRelease(SwipeLayout swipeLayout, float xvel, float yvel) {
                        if(swipeLayout.getOpenStatus() == SwipeLayout.Status.Open) {
                            onPictureHide();
                            swipeLayout.close();
                        }
                    }
                });
    

    This code is in a ViewHolder which is in Adapter which extend RecyclerSwipeAdapter

    The goal is to trig an action once the swipe is visible and totally open. Then it closes itself automatically.

    Unfortunatly the bottom view does not close... With a swipeLayout.close(false); it works but there is the issue #125 ! Finally with a call on adapter.closeItem(position) it works, but there is a mRecyclerAdapter.notifyDataSetChanged(); which destroy my UX.

    Feel free to ask more information ! :)

    opened by darzul 11
  • NullPointerException Error

    NullPointerException Error

    Device MEIZU PRO Android 5.0.1 ROOTED

    java.lang.NullPointerException: Attempt to invoke interface method 'void android.view.ViewParent.requestDisallowInterceptTouchEvent(boolean)' on a null object reference
           at com.daimajia.swipe.SwipeLayout.onTouchEvent(SwipeLayout.java:942)
           at android.view.View.dispatchTouchEvent(View.java:8408)
           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2398)
           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2158)
           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2400)
           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
           at in.srain.cube.views.ptr.PtrFrameLayout.dispatchTouchEventSupper(PtrFrameLayout.java:252)
           at in.srain.cube.views.ptr.PtrFrameLayout.dispatchTouchEvent(PtrFrameLayout.java:328)
           at com.ruguoapp.jike.view.JikeRefreshLayout.dispatchTouchEvent(JikeRefreshLayout.java:36)
           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430)
           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172)
           at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2346)
           at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1701)
           at android.app.Activity.dispatchTouchEvent(Activity.java:2781)
           at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2303)
           at android.view.View.dispatchPointerEvent(View.java:8598)
           at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4158)
           at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4024)
           at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3571)
           at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3624)
           at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3590)
           at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3700)
           at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3598)
           at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3757)
           at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3571)
           at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3624)
           at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3590)
           at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3598)
           at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3571)
           at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5841)
           at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5815)
           at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5786)
           at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5939)
           at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
           at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
           at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
           at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5902)
           at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5962)
           at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
           at android.view.Choreographer.doCallbacks(Choreographer.java:580)
           at android.view.Choreographer.doFrame(Choreographer.java:548)
           at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
           at android.os.Handler.handleCallback(Handler.java:739)
           at android.os.Handler.dispatchMessage(Handler.java:95)
           at android.os.Looper.loop(Looper.java:135)
           at android.app.ActivityThread.main(ActivityThread.java:5226)
           at java.lang.reflect.Method.invoke(Method.java)
           at java.lang.reflect.Method.invoke(Method.java:372)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
    
    opened by renzholy 10
  • notifyDataSetChanged 之后自动关闭的问题

    notifyDataSetChanged 之后自动关闭的问题

    调用 notifyDataSetChanged 布局会自动关闭,翻了好久没找到解决办法,后来我重写了OnLayout方法,临时解决一下 @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { if (isDisableLayout){

            return;
        }
        super.onLayout(changed, l, t, r, b);
        LogUtils.debug("更新布局");
    }
    
    
    //使用notifyDataSetChanged 前,先禁用OnLayout事件
    public void setDisableLayout(boolean _disable){
        this.isDisableLayout = _disable;
    }
    

    使用notifyDataSetChanged之后,在调用listView的layout方法,不知道为什么要加个随机数,否则两次调用layout参数都一致的话也不会更新 listView.layout(0,0,1000+ RandomUtils.getRandom(1,100),2000);

    opened by qq870841070 4
  • Fatal Exception: java.util.ConcurrentModificationException

    Fatal Exception: java.util.ConcurrentModificationException

    Fatal Exception: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.next(ArrayList.java:860) at com.daimajia.swipe.SwipeLayout.dispatchSwipeEvent(SwipeLayout.java:518) at com.daimajia.swipe.SwipeLayout.dispatchSwipeEvent(SwipeLayout.java:497) at com.daimajia.swipe.SwipeLayout$1.onViewPositionChanged(SwipeLayout.java:387) at androidx.customview.widget.ViewDragHelper.continueSettling(ViewDragHelper.java:750) at com.daimajia.swipe.SwipeLayout.computeScroll(SwipeLayout.java:635) at android.view.View.updateDisplayListIfDirty(View.java:22754) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5320) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5292) at android.view.View.updateDisplayListIfDirty(View.java:22731) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5320) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5292) at android.view.View.updateDisplayListIfDirty(View.java:22731)

    opened by jpnapps 2
  • When Swipe item, another item in list automatically swipe #18 #120

    When Swipe item, another item in list automatically swipe #18 #120

    Check this video

    https://drive.google.com/file/d/1ix1Yxdh-EcUAVQ0rhrMNdcLU6BBgSTb1/view

    Any solution for this?

    Also, I want to implement a favorite option I implement it and when I add one item in the favorite list (favorite item's image drawable is changed) another item's image drawable is automatically changed

    opened by kishorramani 5
Releases(v1.2.0)
Owner
代码家
Zhenfund Associate, bp [email protected]
代码家
GoolgePlusLayout is a custom layout that plays animation on the children views while scrolling as the layout in the Google Plus (android) main page

Google Plus Layout Google Plus Layout is a custom layout that support playing animation on child view(s) in a serialize manner like the the main

Ahmed Nammari 224 Nov 25, 2022
Responsive Layout Gird Configuration using Compose. An adaptive layout

ResponsiveGrid Responsive Grid is most followed layout system by the designer as it adapts to screen size and orientation, ensuring consistency across

null 4 Apr 12, 2022
An Android library that help you to build app with swipe back gesture.

SwipeBackLayout An Android library that help you to build app with swipe back gesture. Demo Apk GooglePlay Requirement The latest android-support-v4.j

ike_w0ng 6.1k Dec 29, 2022
swipe display drawer with flowing & bouncing effects.

FlowingDrawer swipe right to display drawer with flowing effects. Download Include the following dependency in your build.gradle file. Gradle: rep

mxn 2.6k Jan 3, 2023
An Android library that help you to build app with swipe back gesture.

SwipeBackLayout An Android library that help you to build app with swipe back gesture. Demo Apk GooglePlay Requirement The latest android-support-v4.j

ike_w0ng 6.1k Jan 3, 2023
FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

null 33 Dec 8, 2022
An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu

ResideLayout An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu. Can be used on Android 1.6(I haven't try it.)

Yang Hui 392 Oct 12, 2022
A very simple arc layout library for Android

ArcLayout A very simple arc layout library for Android. Try out the sample application on the Play Store. Usage (For a working implementation of this

ogaclejapan 1.4k Dec 26, 2022
Android layout that simulates physics using JBox2D

PhysicsLayout Android layout that simulates physics using JBox2D. Simply add views, enable physics, and watch them fall! See it in action with the sam

John Carlson 689 Dec 29, 2022
a custom pull-to-refresh layout which contains a interesting animation

This is a project with custom pull-to-refresh layout which contains a interesting animation. And the animation is inspired by https://dribbble.com/sho

ZhangLei 1.8k Dec 27, 2022
A layout to transition between two views using a Floating Action Button as shown in many Material Design concepts

⚠ This library is no longer maintained ⚠️ FABRevealLayout A layout to transition between two views using a Floating Action Button as shown in many Mat

Tomás Ruiz-López 901 Dec 9, 2022
An Android demo of a foldable layout implementation. Engineered by Vincent Brison.

Foldable Layout This code is a showcase of a foldable animation I created for Worldline. The code is fully written with java APIs from the Android SDK

Worldline 599 Dec 23, 2022
A 3D Layout for Android,When you use it warp other view,it can became a 3D view,一秒让你的view拥有3D效果!

ThreeDLayout A 3D Layout,When you use it warp other view,it can became a 3D view 中文文档 preview USAGE 1.compile library allprojects { repositories {

androidwing 490 Oct 27, 2022
It's an Android library that allows you to use Layout as RadioButton or CheckBox.

Android - CompoundLayout It's an Android library that allows you to use Layout as RadioButton or CheckBox. The librarie is Android 14+ compatible. Gra

null 483 Nov 25, 2022
A pull to refresh layout for android, the RecyclerRefreshLayout is based on the SwipeRefreshLayout. support all the views, highly customizable, code simplicity, etc. really a practical RefreshLayout!

RecyclerRefreshLayout English | 中文版 RecyclerRefreshLayout based on the {@link android.support.v4.widget.SwipeRefreshLayout} The RecyclerRefreshLayout

dinus_developer 1.7k Nov 10, 2022
A layout that creates a loading-like progress around it's child ( circle ) on touch, inspired from Destiny's ( PS4 ) accept mechanism

HoldToLoadLayout HoldToLoadLayout is a view group that can contain a single child. It draws your child to middle of layout, and performs loading wheel

Melih Aksoy 79 Feb 8, 2022
[UNMAINTAINED]: AndroidMosaicLayout is android layout to display group of views as grid consists of different asymmetric patterns (90 different patterns).

AndroidMosaicLayout AndroidMosaicLayout is android layout to display group of views in more that 90 different patterns. What is AndroidMosaicLayout? I

Adham Enaya 474 Nov 12, 2022
Scalable Layout For Android

ScalableLayout for Android. Class: com.ssomai.android.scalablelayout.ScalableLayout 한글버전 README.md: https://github.com/ssomai/ScalableLayout/blob/mast

Youngmann Kim 273 Nov 21, 2022