GithubHelp home page GithubHelp logo

swipestack's People

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

swipestack's Issues

adapter class not getting called

I don't know what is happening but mSwipeStack.setAdapter(mAdapter) is not calling any of my methods in the adapter class even though the mData.size() > 0 in my case and when I replace mSwipeStack with a listview, everything works fine. Anyone experiencing this issue?

Add to top of stack

All cards get added to the bottom of the stack, which is great. However, I'd like to add both from the top and the bottom of the stack. Is there a way to add to top of stack? I've been trying to modify the source code but can't understand how I could change that.
It'd be great if anyone could give me an idea of how I could modify the source code to add to top of stack.
Thanks!

does not set "SAVE" and "NEXT" field on textview when swipe the cardstack.

i want set "SAVE" and "NEXT" field on textview when swipe the cardstack. but text set on 3rd position of cardstack, what is an issue?

cardStack.setSwipeProgressListener(new SwipeStack.SwipeProgressListener() {
@OverRide
public void onSwipeStart(int position) {

        }

        @Override
        public void onSwipeProgress(int position, float progress) {
         
            if (progress < 0) {
                mHolder.textViewSave.setText(getItem(position).getSave());
            } else {
                mHolder.textViewSave.setText(getItem(position).getNull());
            }

            if (progress > 0) {
                mHolder.textViewNext.setText(getItem(position).getNext());
            } else {
                mHolder.textViewNext.setText(getItem(position).getNull());
            }
        }

        @Override
        public void onSwipeEnd(int position) {
        
        }
    });

mData.remove(position) for adapter

hello
thanks for your best library ;
i want remove card from view, how i can do this?

`mData.remove(position);

mAdapter.notifyDataSetChanged();`
this not work

stack is not refreshing

mAdapter.setData(cardsList);

public void setData(List<Card> cards) { this.mData = cards; notifyDataSetChanged(); }

At first my cards list size was 3 then i removed 1 card from list and set it again to adapter and call notifyDataSetChanged(); but it is not refreshing list.
It should show two cards stack. but still it is showing 3 cards in stack.

Dynamically Adding MapView/SupportedMapFragment to CardView?

How can I dynamically add mapview/supportedmapfragment to the CardView under getView in the Adapter? I attempted to add the following code:

@OverRide
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = getLayoutInflater().inflate(R.layout.card, parent, false);
}

        TextView textViewCard = (TextView) convertView.findViewById(R.id.textViewCard);
        textViewCard.setText(mData.get(position));

         // NEW CODE ADDED
        FragmentManager fm = getChildFragmentManager();
        SupportMapFragment supportMapFragment =  SupportMapFragment.newInstance();
        fm.beginTransaction().replace(R.id.mapContainer, supportMapFragment).commit();

        return convertView;
    }

And in the card.xml file a FrameLayout was added like this:

    android:id="@+id/mapContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Even with the above changes, I am only able to get the Test message to print on the Swipe cards. I am looking to get a map on each of the cards that get created. Any help would be appreciated.

Thanks!

Loop Stack and put view on top

How can you return the last swiped card back on top of the stack? And how do you activate endless looping the views. Will those features be available in a future release?

How to vertically center SwipeStack?

I can't seem to vertically center the SwipeStack inside any ViewGroup. I've tried inside a FrameLayout, RelativeLayout and LinearLayout.

Is it possible? If not, any hints on how I can modify the SwipeStack implementation to achieve this?

swipeToPosition

is it possible to swipe to a specific position? for instance to go back one card

How to refresh ui on card swaping

mSwipeStack.setSwipeProgressListener(new SwipeStack.SwipeProgressListener() {
@OverRide
public void onSwipeStart(int position) {

        }

        @Override
        public void onSwipeProgress(int position, float progress) {


            System.out.println("progress...."+progress);

            View mView = mSwipeStack.getTopView();

            if (progress < 0) {
                mView.setBackgroundColor(getResources().getColor(R.color.continue_button_color));
            } else {
                mView.setBackgroundColor(getResources().getColor(R.color.bel_red_text));
            }
        }

        @Override
        public void onSwipeEnd(int position) {
        }
    });

I tried this but not working

onClick() of button doesn't work with current card

holder.op1 = (Button) convertView.findViewById(R.id.option1_card);
holder.op2 = (Button) convertView.findViewById(R.id.option2_card);
holder.op3 = (Button) convertView.findViewById(R.id.option3_card);
holder.op4 = (Button) convertView.findViewById(R.id.option4_card);
        holder.op1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("op1","clicked");
                    holder.op1.setBackgroundColor(Color.WHITE);
                    holder.op1.setTextColor(Color.BLACK);
                }
            });

On clicking button of 1st card, properties of 3rd card gets changed.

notifyDataSetChanged not working

This is my code, I want to update view with notifydatasetchanged, but it is not working

arrDriverOrders.get(position).getOrderMaster().setDriverAccepted(Constant.ORDER_ACCEPT_CODE); mAdapter.notifyDataSetChanged();

ViewPager in Card

It is not possible to use a ViewPager inside a card due to the swipe gestures. But also the click on a TabLayout item does not change the ViewPager's page. Any reasons or fixes on this?

uses-sdk:minSdkVersion 15?

uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [link.fls:swipestack:0.3.0] E:\kaishuapp_android\kaishustory\app\build\intermediates\exploded-aar\link.fls\swipestack\0.3.0\AndroidManifest.xml

problem in get count

hi. great library.
i have a problem for getCount of item after swipe and remove item of view!!
after remove view count of getCount do not decrease?
and when i remove from my list two item of adapter remove. for example if i have 6 item after remove 3 item of my list in swipeRight or left onEmpty method call!!!
how can i fix this bug?

cannot use with Picasso ?

my card.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    card_view:cardCornerRadius="@dimen/card_corner_radius"
    card_view:cardElevation="@dimen/elevation_large">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/ivCard"
            android:src="@drawable/placeholder" />
        <TextView
            android:id="@+id/textViewCard"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textSize="44sp"
            android:text="@string/dummy_text"/>

    </RelativeLayout>



</android.support.v7.widget.CardView>

my adapter

...
@Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            holder = null;
            if (convertView == null) {
                holder = new ViewHolder();
                convertView = getLayoutInflater().inflate(R.layout.card, parent, false);
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            holder.ivCard = (ImageView) convertView.findViewById(R.id.ivCard);
            Picasso.with(mContext).load(mData.get(position).getUrl()).resize(480, 480).centerCrop().into(holder.ivCard);
            Log.e("555",mData.get(position).getUrl());

            holder.tvCard = (TextView) convertView.findViewById(R.id.textViewCard);
            holder.tvCard.setText(mData.get(position).getWho());

            return convertView;
        }

        public class ViewHolder {
            ImageView ivCard;
            TextView tvCard;
        }
...

it only display the text (from the internet but no luck with ImageView to display image (from URL) via Picasso)

getLayoutInflater() does not exist

Hi,
thanks for the awesome lib. I've tried to reproduce your code, and just noticed that getLayoutInflater() is not a method from BaseAdapter nor CardStackAdapter.

Instead, I had to obtain the LayoutInflater from the Context, so another parameter of type Context is needed in the constructor.
If you want, I can provide you a pull request updating the documentation, and also the code if you're interested.

Keep up the good work!

Navigate to an swiped card

Hi,
We have a use case where when we swipe left, we need to show the previous card. Is there a way to do this in the library.
Can you please help.
Thank you

Can't change the card after it is created

I can't change the card after it is created. Can't add items programmatically. Nothing happens. Can you give me advice?

Here is a small example:


public class SwipeStackAdapter extends BaseAdapte
......
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = getLayoutInflater().inflate(R.layout.card, parent, false);
    }
    final LinearLayout linearLayout = (LinearLayout) convertView.findViewById(R.id.linearLayout);
    linearLayout.post(new Runnable() {
        @Override
        public void run() {
            TextView textView = new TextView(getApplication());
            textView.setText("I am a Text");
            textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
            linearLayout.addView(textView);
        }
    });
    return convertView;
}

Project unavailable

for some reason the gradle dependency works fine but when running the sample code the app crashes over a class not found exception

How do I reset the stack immediately?

I want to load more cards as the stack gets emptied.
I want to populate the list with new items and reset the stack.
Calling resetStack causes an animation of returning card which in the end the stack is empty

java.lang.IllegalArgumentException: pointerIndex out of range

Hi, thank you for a superb library. I got a crash report today from Android 4.4.2. Fatal Exception: java.lang.IllegalArgumentException: pointerIndex out of range

Fatal Exception: java.lang.IllegalArgumentException: pointerIndex out of range
at android.view.MotionEvent.nativeGetAxisValue(MotionEvent.java)
at android.view.MotionEvent.getX(MotionEvent.java:1979)
at link.fls.SwipeHelper.onTouch(SwipeHelper.java:55)
at android.view.View.dispatchTouchEvent(View.java:7772)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2316)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2013)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2350)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1985)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2322)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1985)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2322)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1985)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2322)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1985)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2322)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1985)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2322)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1985)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2322)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1985)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2322)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1985)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2109)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1541)
at android.app.Activity.dispatchTouchEvent(Activity.java:2491)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2057)
at android.view.View.dispatchPointerEvent(View.java:7973)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4392)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4263)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3809)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3859)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3828)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3935)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3836)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3992)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3809)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3859)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3828)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3836)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3809)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6124)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6104)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6058)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6254)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)

How to set permanent width of card in cardstack

I tried to set a width using android:width="480dp" in my card.xml file. But because I use an imageview on the card, and use img.setResource(R.drawable.img); to set image on the card stack then resizes the card according to the width of the image, any fix?

Nativescript implementation

This isn't so much of an issue, but a enhancement suggestion.

Do you know if SwipeStack has ever been used in a Nativescript application? I think it would benefit a lot of users if a 'port' was created that was compatible with Nativescript.

Adapter is not reusing views

Every time a card has to be displayed convertView is null and has to be inflated. getViewTypeCount and getItemViewType are never called

java.lang.IllegalArgumentException: pointerIndex out of range

Hi, sometimes when randomly swiping I get this

java.lang.IllegalArgumentException: pointerIndex out of range
at android.view.MotionEvent.nativeGetAxisValue(Native Method)
at android.view.MotionEvent.getX(MotionEvent.java:2072)
at link.fls.swipestack.SwipeHelper.onTouch(SwipeHelper.java:58)
at android.view.View.dispatchTouchEvent(View.java:9335)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2553)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2240)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2581)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2559)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2559)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2559)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2559)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2559)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2559)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2559)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2559)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2197)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2453)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1755)
at android.app.Activity.dispatchTouchEvent(Activity.java:2776)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2402)
at android.view.View.dispatchPointerEvent(View.java:9590)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4436)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4292)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3816)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3875)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3841)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3971)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3849)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4028)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3821)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3875)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3841)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3849)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3821)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6150)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6118)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6072)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6253)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:216)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.refl

Might be related to Baseflow/PhotoView#31, was thinking can fix this by adding a try catch to SwipeHelper.OnTouch()
Any ideas would be great!

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.