Comments (3)
Ya man, been struggling with the same.
You'd have to add the previous item into the array list again at the top position and then update the adapter.
Haven't found the right logic to do that yet though.
from swipestack.
Hello @joshvarun @karan26796 in the adapter add an array with the deleted objects and create two methods that are the following:
private List<String> mData;
private List< String> mDataDeleted;
public void next(){
mDataDeleted.add(mData.get(0));
mData.remove(0);
}
public void back(){
mData.add(0,mDataDeleted.get(mDataDeleted.size()-1));
mDataDeleted.remove(mDataDeleted.size()-1);
}
I realized that the adapter does not remove the element from the list, so when I swipe the intercept and call the next method that is in the adapter.
swipeStack.setListener(new SwipeStack.SwipeStackListener() {
@Override
public void onViewSwipedToLeft(int i) {
swipeStackAdapter.next();
}
@Override
public void onViewSwipedToRight(int i) {
swipeStackAdapter.next();
}
@Override
public void onStackEmpty() {
}
});
finally when I click on the back button I call the back method of the adapter and update everything with resetStack()
@OnClick(R.id.btnBack)
public void back(){
swipeStackAdapter.back();
swipeStack.resetStack();
}
I hope I help you
hug, greetings
from swipestack.
@tundisi Thank you. Your solution worked. Only problem is that the "back" Animation is not smooth, is there any way to make it smooth?
from swipestack.
Related Issues (20)
- java.lang.IllegalArgumentException: pointerIndex out of range HOT 2
- Dynamically Adding MapView/SupportedMapFragment to CardView?
- Navigate to an swiped card
- getLayoutInflater() does not exist HOT 2
- How can arrange this in right side?
- getLayoutInflater() does not exist HOT 2
- How to set overlay image during left or right swipe like "DISLINE" or "LIKE" ?
- Cards sequence is not getting properly.
- Setting dynamic height
- Undo HOT 1
- Question about swipestack child views
- Adapter not triggered on my phone
- Adapter not called for the second time HOT 1
- Vertical scrollbars disables swipe HOT 1
- Not working with object list
- SwipeStack is not Visible HOT 10
- How to use recycle view for every swipe card
- SwipeStack not visible when converted to fragment
- ViewPager inside adapter HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swipestack.