Code Monkey home page Code Monkey logo

Comments (5)

wdullaer avatar wdullaer commented on May 27, 2024

You didn't set a background view?

Without any code, it's more or less impossible for me to help you.

from swipeactionadapter.

moshea444 avatar moshea444 commented on May 27, 2024

I'm having the same issue. I pretty much just copy and pasted the example code on the git home screen. This is where the issue happens in the SwipeActionAdapter code:

@Override public boolean onInterceptTouchEvent(MotionEvent ev) { // Start tracking the touch when a child is processing it return super.onInterceptTouchEvent(ev) || swipeTouchListener.onTouch(this, ev); }

Here is my code setting up the adapter:

`mAccountAdapter.addBackground(SwipeDirection.DIRECTION_FAR_LEFT, R.layout.row_account_left)
.addBackground(SwipeDirection.DIRECTION_FAR_RIGHT, R.layout.row_account_right)
.addBackground(SwipeDirection.DIRECTION_NORMAL_LEFT, R.layout.row_account_left)
.addBackground(SwipeDirection.DIRECTION_NORMAL_RIGHT, R.layout.row_account_right)
.addBackground(SwipeDirection.DIRECTION_NEUTRAL, R.layout.row_account_left);

    mAccountAdapter.setSwipeActionListener(new SwipeActionAdapter.SwipeActionListener(){
        @Override
        public boolean hasActions(int position, SwipeDirection direction){
            if(direction.isLeft()) return true; // Change this to false to disable left swipes
            if(direction.isRight()) return true;
            return false;
        }

        @Override
        public boolean shouldDismiss(int position, SwipeDirection direction){
            // Only dismiss an item when swiping normal left
            return direction == SwipeDirection.DIRECTION_NORMAL_LEFT;
        }

        @Override
        public void onSwipe(int[] positionList, SwipeDirection[] directionList){
            for(int i=0;i<positionList.length;i++) {
                SwipeDirection direction = directionList[i];
                int position = positionList[i];
                String dir = "";

                switch (direction) {
                    case DIRECTION_FAR_LEFT:
                        dir = "Far left";
                        break;
                    case DIRECTION_NORMAL_LEFT:
                        dir = "Left";
                        break;
                    case DIRECTION_FAR_RIGHT:
                        dir = "Far right";
                        break;
                    case DIRECTION_NORMAL_RIGHT:
                        AlertDialog.Builder builder = new AlertDialog.Builder(mHomeActivity);
                        builder.setTitle("Test Dialog").setMessage("You swiped right").create().show();
                        dir = "Right";
                        break;
                }
                Toast.makeText(
                        mHomeActivity,
                        dir + " swipe Action triggered on " + mAccountAdapter.getItem(position),
                        Toast.LENGTH_SHORT
                ).show();
                mAccountAdapter.notifyDataSetChanged();
            }
        }
    });`

from swipeactionadapter.

wdullaer avatar wdullaer commented on May 27, 2024

Does it also happen if you just run the sample app?
Does it happen on each swipe?
If it doesn't happen with the sample add, could you change the sample app until it does happen?

I can't reproduce this right now, which makes it hard to fix

from swipeactionadapter.

Hakens avatar Hakens commented on May 27, 2024

Same here, any solution?

from swipeactionadapter.

trauchhaupt avatar trauchhaupt commented on May 27, 2024

In my case, it is because mDownViewGroup is not set in SwipeActionTouchListener:268 because the cast to SwipeViewGroup does not work (It is of type RelativeLayout).

This was due to overriding SwipeActionAdapter and overriding the getView() method in it.

from swipeactionadapter.

Related Issues (20)

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.