SwipeStack icon indicating copy to clipboard operation
SwipeStack copied to clipboard

SwipeStack doesn't respond with the update in the list associated with the adapter of it.

Open masudias opened this issue 9 years ago • 7 comments

I want the list of items to be changed dynamically. So when the list of items are changed, the swipe stack doesn't take effect instantly. When the number of items in the list is changed, notifyDataSetChanged is called on the adapter associated with it. But it doesn't take effect in the swipe stack. It doesn't update the stack as per the change in adapter.

masudias avatar Mar 09 '16 07:03 masudias

Same problem here.

tristangrichard avatar Mar 21 '16 14:03 tristangrichard

Thanks, @comeondude @trramsiq ! I will look into this :wink:

flschweiger avatar Mar 24 '16 07:03 flschweiger

i don't know if what i'm doing is similar to this, but if i remove an item from my list onViewSwipedToRight or onViewSwipedToLeft, i get an IndexArrayOutofBounds exception

n1schal avatar Apr 07 '16 10:04 n1schal

In my case, it is sufficient to change the adapter base class from BaseAdapter to ArrayAdapter or another providing a concrete implementation of notifyDataSetChanged(). If you don't want to change the Adapter base class, just override the notifyDataSetChanged() to add the new data to the adapter data. This solved the problem for me, hope it helps.

Maybe @flschweiger could change the sample application provided with the library to reflect this?

`MySwipeStackAdapter

public class MySwipeStackAdapter extends ArrayAdapter<String> {

    private List<String> mAdapterData;

    public MySwipeStackAdapter(Context context, int resource, List<String> data) {
        super(context, resource, data);
        mAdapterData = data;
    }

    @Override
    public int getCount() {
        return mAdapterData.size();
    }

    @Override
    public String getItem(int position) {
        return mAdapterData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

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

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

        return convertView;
    }
}`

PieCampi avatar Jul 06 '16 07:07 PieCampi

Hi, is this issue will be fixed?

dehimb avatar Aug 16 '16 13:08 dehimb

Same problem. I could call resetStack but this will re-attach all views , which is expensive operation

TheLester avatar Feb 23 '17 17:02 TheLester

@flschweiger any update about this?

krisnamargono avatar Jun 16 '17 05:06 krisnamargono