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]
代码家
Login form with Godsteam layout in Java only.

Android Login Form in Java with Godsteam layout Login form with Godsteam layout in Java only. There is no PHP and menu source, you must implement them

Menu Modder 10 Oct 8, 2022
PostgreSQL is the world's most advanced open source database. Also, PostgreSQL is suitable for Event Sourcing. This repository provides a sample of event sourced system that uses PostgreSQL as event store.

Event Sourcing with PostgreSQL Introduction Example Domain Event Sourcing and CQRS 101 State-Oriented Persistence Event Sourcing CQRS Advantages of CQ

Evgeniy Khyst 146 Dec 20, 2022
XR3Player - The MOST ADVANCED JavaFX Media Player

Support me joining PI Network app with invitation code AlexKent I am in search for developers to keep on where i left XR3Player :) XR3Player ( Downloa

GOXR3PLUS STUDIO 613 Dec 17, 2022
A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.

⚡ A powerful & easy to use chart library for Android ⚡ Charts is the iOS version of this library Table of Contents Quick Start Gradle Maven Documentat

Philipp Jahoda 36k Jan 9, 2023
Facsimile - Copy Your Most Used Text to Clipboard Easily with Facsimile!. It Helps You to Store You Most Used Text as a Key, Value Pair and Copy it to Clipboard with a Shortcut.

Facsimile An exact copy of Your Information ! Report Bug · Request Feature Table of Contents About The Project Built With Getting Started Installation

Sri lakshmi kanthan P 1 Sep 12, 2022
LimboFilter - Most powerful bot filtering solution for Minecraft proxies. Built with LimboAPI.

LimboFilter Most powerful bot filtering solution for Minecraft proxies. Built with LimboAPI. MC-Market SpigotMC.org Описание и обсуждение на русском я

Elytrium 80 Jan 6, 2023
Layout and functional testing framework for websites

Galen Framework master: Galen is an open-source tool for testing layout and responsive design of web applications. It is also a powerfull functional t

Galen Framework 1.4k Dec 10, 2022
A low intrusive, configurable android library that converts layout XML files into Java code to improve performance

qxml English 一个低侵入,可配置的 Android 库,用于将 layout xml 文件转换为 Java 代码以提高性能。 与X2C的对比 X2C: 使用注解处理器生成View类,使用时需要在类中添加注解,并替换setContentView方法,侵入性较强; 对于布局属性的支持不够完美

null 74 Oct 6, 2022
Login form with Godsteam layout in Java only.

Android Login Form in Java with Godsteam layout Login form with Godsteam layout in Java only. There is no PHP and menu source, you must implement them

Menu Modder 10 Oct 8, 2022
A quiz app with great layout design, dynamic questions using firebase and what not....

AndroidQuizApp An android quiz app created using Android Studio with our language JAVA that has great layout design, dynamic questions using firebase

Ejaz Mahmood 4 Dec 30, 2022
⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations

⭕️ CircleMenu is a simple, elegant UI menu with a circular layout and material design animations. Android UI library made by @Ramotion

Ramotion 1.9k Dec 27, 2022
Most popular Mocking framework for unit tests written in Java

Most popular mocking framework for Java Current version is 3.x Still on Mockito 1.x? See what's new in Mockito 2! Mockito 3 does not introduce any bre

mockito 13.6k Jan 9, 2023
An application metrics facade for the most popular monitoring tools. Think SLF4J, but for metrics.

Micrometer Application Metrics An application metrics facade for the most popular monitoring tools. Instrument your code with dimensional metrics with

Micrometer Metrics 3.7k Dec 30, 2022
The most powerfull forge server software (not yet) which aims for high capacity and performance on 1.16.5 modded server.

GoldenForge The most powerfull forge server software (not yet) which aims for high capacity and performance on 1.16.5 modded server. Current work Asyn

null 20 Sep 3, 2022
PostgreSQL is the world's most advanced open source database. Also, PostgreSQL is suitable for Event Sourcing. This repository provides a sample of event sourced system that uses PostgreSQL as event store.

Event Sourcing with PostgreSQL Introduction Example Domain Event Sourcing and CQRS 101 State-Oriented Persistence Event Sourcing CQRS Advantages of CQ

Evgeniy Khyst 146 Dec 20, 2022
A minecraft forge lib that is used by most of my mods.

MatyLib A minecraft forge lib that is used by most of my mods. Installing (for modders) Before installing, please decide on what version you want, by

matyrobbrt 2 Jan 7, 2022
🕊️ The world's most advanced open source instant messaging engine for 100K~10M concurrent users https://turms-im.github.io/docs

简体中文 What is Turms Turms is the most advanced open-source instant messaging engine for 100K~10M concurrent users in the world. Please refer to Turms D

null 1.2k Dec 27, 2022
The Most Advanced Time Series Platform

Warp 10 Platform Introduction Warp 10 is an Open Source Geo Time Series Platform designed to handle data coming from sensors, monitoring systems and t

SenX 322 Dec 29, 2022