Skip to content
Browse files

Added choice for setting the items with or without animation.

  • Loading branch information...
1 parent aa49b9c commit 0f45b5576bfb2620622dbc5c53780e59dad24ea7 @roughike committed
View
6 swipe-selector/src/main/java/com/roughike/swipeselector/SwipeAdapter.java
@@ -287,10 +287,10 @@ public void setSelectedItem(int position, boolean animate) {
}
}
- public void setSelectedItem(SwipeItem item) {
+ public void setSelectedItem(Object value, boolean animate) {
for (int i = 0; i < mItems.size(); i++) {
- if (mItems.get(i).equals(item)) {
- mViewPager.setCurrentItem(i, true);
+ if (mItems.get(i).value.equals(value)) {
+ mViewPager.setCurrentItem(i, animate);
break;
}
}
View
8 swipe-selector/src/main/java/com/roughike/swipeselector/SwipeSelector.java
@@ -195,7 +195,11 @@ public void setSelectedItem(int position, boolean animate) {
mAdapter.setSelectedItem(position, animate);
}
- public void setSelectedItem(SwipeItem item) {
- mAdapter.setSelectedItem(item);
+ public void setSelectedItem(Object value) {
+ setSelectedItem(value, true);
+ }
+
+ public void setSelectedItem(Object value, boolean animate) {
+ mAdapter.setSelectedItem(value, animate);
}
}

0 comments on commit 0f45b55

Please sign in to comment.
Something went wrong with that request. Please try again.