-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathMainActivity.java
More file actions
74 lines (65 loc) · 2.78 KB
/
MainActivity.java
File metadata and controls
74 lines (65 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package smart.ui.proswipebutton_app;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import smart.ui.proswipebutton.ProSwipeButton;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final ProSwipeButton proSwipeBtn = findViewById(R.id.proswipebutton_main);
final ProSwipeButton proSwipeBtnError = findViewById(R.id.proswipebutton_main_error);
final ProSwipeButton reverseProSwipeBtn = findViewById(R.id.proswipebutton_main_reverse);
final ProSwipeButton reverseProSwipeBtnError = findViewById(R.id.proswipebutton_main_reverse_error);
proSwipeBtn.setSwipeDistance(0.5f);
proSwipeBtn.setOnSwipeListener(new ProSwipeButton.OnSwipeListener() {
@Override
public void onSwipeConfirm() {
// user has swiped the btn. Perform your async operation now
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
proSwipeBtn.showResultIcon(true, false);
}
}, 2000);
}
});
proSwipeBtnError.setOnSwipeListener(new ProSwipeButton.OnSwipeListener() {
@Override
public void onSwipeConfirm() {
// user has swiped the btn. Perform your async operation now
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
proSwipeBtnError.showResultIcon(false, true);
}
}, 2000);
}
});
reverseProSwipeBtn.setOnSwipeListener(new ProSwipeButton.OnSwipeListener() {
@Override
public void onSwipeConfirm() {
// user has swiped the btn. Perform your async operation now
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
reverseProSwipeBtn.showResultIcon(true, true);
}
}, 2000);
}
});
reverseProSwipeBtnError.setOnSwipeListener(new ProSwipeButton.OnSwipeListener() {
@Override
public void onSwipeConfirm() {
// user has swiped the btn. Perform your async operation now
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
reverseProSwipeBtnError.showResultIcon(false, true);
}
}, 2000);
}
});
}
}