Skip to content

Commit ca792b5

Browse files
committed
Use addDrag instead of deprecated methods
1 parent f9ac392 commit ca792b5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

demo/src/main/java/com/daimajia/swipedemo/MyActivity.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ protected void onCreate(Bundle savedInstanceState) {
2929

3030
sample1 = (SwipeLayout) findViewById(R.id.sample1);
3131
sample1.setShowMode(SwipeLayout.ShowMode.PullOut);
32-
// sample1.setDragEdges(SwipeLayout.DragEdge.Left, SwipeLayout.DragEdge.Right, SwipeLayout.DragEdge.Top);
33-
// When using multiple drag edges it's a good idea to pass the ids of the views that you're using for the left, right, top bottom views (-1 if you're not using a particular view)
34-
sample1.setBottomViewIds(R.id.bottom_wrapper, R.id.bottom_wrapper_2, R.id.starbott, R.id.starbott);
32+
View starBottView = sample1.findViewById(R.id.starbott);
33+
sample1.addDrag(SwipeLayout.DragEdge.Left, sample1.findViewById(R.id.bottom_wrapper));
34+
sample1.addDrag(SwipeLayout.DragEdge.Right, sample1.findViewById(R.id.bottom_wrapper_2));
35+
sample1.addDrag(SwipeLayout.DragEdge.Top, starBottView);
36+
sample1.addDrag(SwipeLayout.DragEdge.Bottom, starBottView);
3537
sample1.addRevealListener(R.id.delete, new SwipeLayout.OnRevealListener() {
3638
@Override
3739
public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) {
@@ -90,7 +92,7 @@ public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int
9092

9193
sample2 = (SwipeLayout) findViewById(R.id.sample2);
9294
sample2.setShowMode(SwipeLayout.ShowMode.LayDown);
93-
sample2.setDragEdge(SwipeLayout.DragEdge.Right);
95+
sample2.addDrag(SwipeLayout.DragEdge.Right, sample2.findViewWithTag("Bottom2"));
9496
// sample2.setShowMode(SwipeLayout.ShowMode.PullOut);
9597
sample2.findViewById(R.id.star).setOnClickListener(new View.OnClickListener() {
9698
@Override
@@ -129,7 +131,7 @@ public void onClick(View v) {
129131
//sample3
130132

131133
sample3 = (SwipeLayout) findViewById(R.id.sample3);
132-
sample3.setDragEdge(SwipeLayout.DragEdge.Top);
134+
sample3.addDrag(SwipeLayout.DragEdge.Top, sample3.findViewWithTag("Bottom3"));
133135
sample3.addRevealListener(R.id.bottom_wrapper_child1, new SwipeLayout.OnRevealListener() {
134136
@Override
135137
public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) {

0 commit comments

Comments
 (0)