Coder Social home page Coder Social logo

androidswipelayout's Introduction

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. 😃

androidswipelayout's People

Contributors

amartinz avatar amenon avatar chongzhe avatar daimajia avatar daisy1754 avatar gitter-badger avatar harshevilgeek avatar intrications avatar jpshelley avatar linfaxin avatar noinnion avatar pt2121 avatar rahulrj avatar sergiandreplace avatar stephanebg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androidswipelayout's Issues

NullPointerException SwipeLayout.onTouchEvent

java.lang.NullPointerException
at com.daimajia.swipe.SwipeLayout.onTouchEvent(SwipeLayout.java:811)
at android.view.View.dispatchTouchEvent(View.java:5541)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1951)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1712)
at com.daimajia.swipe.SwipeLayout.dispatchTouchEvent(SwipeLayout.java:639)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1912)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1371)
at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1860)
at android.view.View.dispatchPointerEvent(View.java:5721)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:812)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:579)
at dalvik.system.NativeStart.main(NativeStart.java)

SwipeAdapter extending CursorAdapter ?

Hello,

I'd like to populate a ListView with SwipeLayouts and data from a Cursor. Are you planning to provide a SwipeAdapter extending a CursorAdapter ? Is there a simple way to do it ?

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

Swipe to Hide not working

I'm trying to use this library and swiping to reveal is working, but when I swipe in the opposite direction to hide the view again, it's not working. Am I missing something code wise?

setSwipeEnabled not working?

Hey,
I tried disabling the swipe using this method but i didn't see any results. I was still able to swipe.
I checked a bit the source of SwipeLayout.java but the variable is just set and not used anywhere else in the code.

SwipeLayout With listselector

在listview里面使用SwipeLayout,设置的listSelector 不好用。 试了各种方法 都未见效,只有一种,设置item的background,但是这个在滑动的一瞬间,手指所在的那个item会选中一下
求解

onClick listener on surface view

I'm trying to add an onClick listener to the surface view so that when bottom view is expanded and users click on the remaining visible surface view the swipe view toggle closed. When I add the click listener dragging breaks. Is this intended?

ListView inside swipe view causes it to close.

Hi,

I'm putting a ListView inside my view which is shown during a swipe. Upon swiping it up, it does not animate and instead opens fully, then forces closes down.

I also get numerous "requestLayout() improperly called by com.daimajia.swipe.SwipeLayout" warnings.

Here is my XML

<?xml version="1.0" encoding="utf-8"?>

<com.daimajia.swipe.SwipeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fragment_feed_detail_swipe"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<include android:id="@+id/fragment_feed_detail_swipe_list"
         layout="@layout/swipe_comments"/>

<ScrollView
    android:id="@+id/fragment_feed_detail_scroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/fragment_feed_detail_scroll_child"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <FrameLayout
            android:id="@+id/fragment_feed_detail_heading"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:weightSum="4"
            android:orientation="horizontal"
            android:padding="16dp">

            <ImageView
                android:id="@+id/fragment_feed_detail_fav"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="centerInside"
                android:src="@drawable/ic_action_rating_not_important"
                android:background="?android:attr/listChoiceBackgroundIndicator"/>

            <ImageView
                android:id="@+id/fragment_feed_detail_share"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="centerInside"
                android:src="@drawable/ic_action_social_share"
                android:background="?android:attr/listChoiceBackgroundIndicator"/>

            <ImageView
                android:id="@+id/fragment_feed_detail_open"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="centerInside"
                android:src="@drawable/ic_action_location_web_site"
                android:background="?android:attr/listChoiceBackgroundIndicator"/>

            <ImageView
                android:id="@+id/fragment_feed_detail_copy"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="centerInside"
                android:src="@drawable/ic_action_content_copy"
                android:background="?android:attr/listChoiceBackgroundIndicator"/>
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/darker_gray"/>

        <org.sufficientlysecure.htmltextview.HtmlTextView
            android:id="@+id/fragment_feed_detail_body"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            android:paddingTop="16dp"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"

            android:textSize="16sp"/>

        <ImageView
            android:id="@+id/fragment_feed_detail_pullup_icon"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="8dp"
            android:layout_gravity="center"
            android:scaleType="centerInside"
            android:src="@drawable/ic_navigation_drawer"/>

    </LinearLayout>

</ScrollView>

</com.daimajia.swipe.SwipeLayout>

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();

            }

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.

Can't implement double tap

Hello again! :)
I have FrameLayout and SwipeLayout inside it.
I implemented double tap listener with GestureDetector on my FrameLayout, but it is not work properly with SwipeLayout. Double tap event fire randomly (I tap 10 times very fast but get only 1 or 2 double tap event instead of 5). If I remove SwipeLayout from view or set it visibility to GONE - double tap work fine. My view:

<FrameLayout>
  <RelativeLayout>
    <SwipeLayout/> // 2 viewGroup inside.
  </RelativeLayout>
</FrameLayout>

And some element outside and inside RelativeLayout
My code:

class MyFrameLayout extends FrameLayout {
...
    @Override public boolean onInterceptTouchEvent(MotionEvent ev) {
        return gestureDetector.onTouchEvent(ev) && super.onInterceptTouchEvent(ev);
    }

    protected class GestureListener extends GestureDetector.SimpleOnGestureListener {

        @Override
        public boolean onDown(MotionEvent e) {
            return true;
        }

        @Override
        public boolean onDoubleTap(MotionEvent e) {
            someActions();
            return false;
        }
    }

...
}

If you need more details then feel free to ask it.

SwipeLayout inside ViewGroup inside SwipeRefreshLayout

SwipeRefreshLayout is the official "pull to refresh" layout. I have a ListView that is inside of a SwipeRefreshLayout, and I am using SwipeLayout as my list item rows.

Is there a good way for me to stop the "pull down" action of the SwipeRefreshLayout when I am horizontally scrolling the SwipeLayout when at the top of the ListView? What happens is that when at the top of the ListView, it is really difficult to horizontally pull the SwipeLayout without accidentally resetting it due to the "pull down" action of the SwipeRefreshLayout activating.

demo minSdkVersion 18?

Hey:)
I find it really attractive!we could definitely use your library in our project.But Maybe you write wrong minSdkVersion .here

can't disable item in list view

First of all awesome library man..
But there is only one problem i am facing i cant disable any listview item..
i try using is enable override mathod of adpter but still item is enabled..
please answer asap....

How to know whether the layout is swiped?

i use swipedlayout in Listview. then i need to judge whether the layout in the item is swiped.I use V1.0.3.jar in my project and i cannot find a method to do this.
I try to read the source code but some method cannot be found when i am coding.
can you tell me how to solve this problem?
maybe i should use the library T_T.

General mobile discovery 2

I have a problem with swipe on General Mobile Discovery 2. While im swiping, layout doesnt change. After hand release, layout swipes(open) immediately and back to close state. i debugged swipeListener and everything seems normal.

onTouchEvent exits prematurely if the SwipeLayout is not the root AdapterView item

Inside SwipeLayout.onTouchEvent() there is a check called isEnabledInAdapterView() which will return false if the SwipeLayout instance is inside an AdapterView.

public boolean onTouchEvent(MotionEvent event)
{
        if(!isEnabledInAdapterView() || !isEnabled())
            return true;
...

This is because inside i_sEnabledInAdapterView()_, getPositionForView() will be looking for
a direct child of the list; it expects the SwipeLayout instance to be the root element which is not always the case.

private boolean isEnabledInAdapterView(){
    AdapterView adapterView = getAdapterView();
    boolean enable = true;
    if(adapterView != null){
        Adapter adapter = adapterView.getAdapter();
        if(adapter != null){
            int p = adapterView.getPositionForView(SwipeLayout.this);
            if(adapter instanceof BaseAdapter){
                enable = ((BaseAdapter) adapter).isEnabled(p);
            }else if(adapter instanceof ListAdapter){
                enable = ((ListAdapter) adapter).isEnabled(p);
            }
        }
    }
    return enable;
}

Simply returning true always here solves the problem. It is also going to make touch events faster, because there is no recursive calls to find the parent (which occurs for every touch!).

Right now we have a "hard" patch to just return true for isEnabledInAdapterView(). It would be useful if all private methods could be protected instead so that behavior can be customized when needed. Thanks for the great library!

To have directional swipe

Can it support Listview with both direction swipe(left and right) and having (different back view when swipe left or right ) ?

What i tried

swipeLayout.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            float x1 = 0, x2, y1 = 0, y2, dx, dy;

            switch (event.getAction()) {
            case (MotionEvent.ACTION_DOWN):
                x1 = event.getX();
                y1 = event.getY();
                break;
            case (MotionEvent.ACTION_UP):
                x2 = event.getX();
                y2 = event.getY();
                dx = x2 - x1;
                dy = y2 - y1;

                // Use dx and dy to determine the direction
                if (Math.abs(dx) > Math.abs(dy)) {
                    if (dx > 0) {
                        System.out.println("Swipe left");
                        swipeLayout.setDragEdge(DragEdge.Left);
                    } else {
                        System.out.println("Swipe Right");
                        swipeLayout.setDragEdge(DragEdge.Right);
                    }

                }
            }

            return false;
        }
    });

BottomView items with drawable selector for pressed state

My BottomVIew it's composed with two "buttons":

BottomView (LinearLayout):
*layout_width="200dp"
*android:layout_height="wrap_content"
*android:minHeight="90dp"
*android:orientation="horizontal"

Button1 (LinearLayout):
*android:layout_width="0dp"
*android:layout_height="match_parent"
*android:layout_weight="1"
...

--ImageView (with a selector for android:src)
--TextView

Button 2 (LinearLayout) equal to Button 1

My problem is with the selector state "pressed". Button 1 works fine but Button 2 or any other View I add as a button (3, 4,...) have his state "pressed" randomly changed when I click in other buttons or in the SurfaceView.

Can't figure out why. I was looking at your sample app but it doesn't include selectors for BottomView views.

Thanks for your time.

ScrollView inside SwipeLayout

Hi,

I want to put a ScrollView inside a SwipeLayout.

However, SwipeLayout does not work with ScrollView. It disables scrolling and when you get to bottom, it opens up the BottomView, instead of continuing to scroll.

How can this be done?

No way to disable swipe gesture

I want to disable swipe gesture in certain case.
I try to set setDragEdge(null) but got NPE, try to swipeLayout.setEnabled(false) and it is not work.
Please add this feature or tell me how do it.

RecycleView support

hi ,your library is great ! i currently use that in my project , can you add support for the new RecycleView .thanks

Not working great in Android 2.3.5

In Android 2.x versions that i checked, sometimes

  1. When i try to swipe a row of ListView, it comes back from the point i lift my fingers up.
  2. And if i swipe the items immediately one after the other, then the listview hangs and i am unable to scroll.
  3. It crashes on OnItemClick() because the View( the row which was pressed) ,comes out to be null.

All these issues occurred in the demo that is included with this library.

the clicklistener on listview's item intercepts swipe gesture

I set click listener on item, what's the behaviour I want is when I swiped it can show the menu below the surface view,and when I click can trigger the click listener on the surface view,besides when open the menu below,the touchevent on the surface view can be intercepted. How to config it?

Setting left or right offset

How can i set left or right offset so that the view doesnt swipe to the full distance in ListView? Its there in 47deg/SwipeListView. Also on scroll, sometimes the swiped item closes and sometimes it doesnt.

Click to colse others

I think you should just allow one view to be swiped at the same time. When I click other one,the one I swiped before may be closed. Or can you make this customizable?

ArrayIndexOutOfBoundsException when dragging 2 list items at once

Exception stack is

java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1004)
at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:979)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2073)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2326)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1612)
at android.app.Activity.dispatchTouchEvent(Activity.java:2494)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2274)
at android.view.View.dispatchPointerEvent(View.java:8025)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4668)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4556)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4150)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4207)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4176)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4261)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4184)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4318)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4150)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4207)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4176)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4184)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4150)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6302)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6240)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6211)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6382)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:177)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6355)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6401)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:559)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at dalvik.system.NativeStart.main(Native Method)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)

When setting up a SwipeAdapter, the close() method of the SwipeLayout only closes the last item on the ListView.

My problem is this: I want the SwipeLayout to close (the surfaceview to slide back and cover the bottom view) when I touch a certain touch target on the bottom view. For this, I set an OnClickListener on the item on the bottom view that I'm interested in and then call SwipeLayout.close() when the item is clicked.

Unfortunately, this only works on the last item of the ListView. All the previous ones do not exhibit the desired behaviour - that is, when I touch the item with the OnClickListener, the close() method appears to do nothing and the SwipeLayout stays open (everything else in the OnClickListener runs perfectly).

I do not set any listeners in the generateView() method, everything happens in the fillValues() method. I'm stumped!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.