File tree Expand file tree Collapse file tree 3 files changed +51
-4
lines changed
java/in/shadowfax/proswipebutton_app
proswipebutton/src/main/java/in/shadowfax/proswipebutton Expand file tree Collapse file tree 3 files changed +51
-4
lines changed Original file line number Diff line number Diff line change 11package in .shadowfax .proswipebutton_app ;
22
3- import android .support .v7 .app .AppCompatActivity ;
43import android .os .Bundle ;
4+ import android .os .Handler ;
5+ import android .support .v7 .app .AppCompatActivity ;
6+
7+ import in .shadowfax .proswipebutton .ProSwipeButton ;
58
69public class MainActivity extends AppCompatActivity {
710
811 @ Override
912 protected void onCreate (Bundle savedInstanceState ) {
1013 super .onCreate (savedInstanceState );
1114 setContentView (R .layout .activity_main );
15+
16+ final ProSwipeButton proSwipeBtn = findViewById (R .id .proswipebutton_main );
17+ final ProSwipeButton proSwipeBtnError = findViewById (R .id .proswipebutton_main_error );
18+
19+ proSwipeBtn .setOnSwipeListener (new ProSwipeButton .OnSwipeListener () {
20+ @ Override
21+ public void onSwipeConfirm () {
22+ // user has swiped the btn. Perform your async operation now
23+ new Handler ().postDelayed (new Runnable () {
24+ @ Override
25+ public void run () {
26+ proSwipeBtn .showResultIcon (true );
27+ }
28+ }, 2000 );
29+ }
30+ });
31+
32+ proSwipeBtnError .setOnSwipeListener (new ProSwipeButton .OnSwipeListener () {
33+ @ Override
34+ public void onSwipeConfirm () {
35+ // user has swiped the btn. Perform your async operation now
36+ new Handler ().postDelayed (new Runnable () {
37+ @ Override
38+ public void run () {
39+ proSwipeBtnError .showResultIcon (false );
40+ }
41+ }, 2000 );
42+ }
43+ });
1244 }
1345}
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
2- <RelativeLayout xmlns : android =" http://schemas.android.com/apk/res/android"
2+ <LinearLayout xmlns : android =" http://schemas.android.com/apk/res/android"
3+ xmlns : app =" http://schemas.android.com/apk/res-auto"
34 xmlns : tools =" http://schemas.android.com/tools"
45 android : layout_width =" match_parent"
56 android : layout_height =" match_parent"
7+ android : orientation =" vertical"
68 tools : context =" in.shadowfax.proswipebutton_app.MainActivity" >
79
810 <in .shadowfax.proswipebutton.ProSwipeButton
11+ android : id =" @+id/proswipebutton_main"
912 android : layout_width =" match_parent"
10- android : layout_height =" wrap_content" />
13+ android : layout_height =" wrap_content"
14+ android : layout_margin =" 8dp"
15+ app : btn_text =" Place Order" />
1116
12- </RelativeLayout >
17+ <in .shadowfax.proswipebutton.ProSwipeButton
18+ android : id =" @+id/proswipebutton_main_error"
19+ android : layout_width =" match_parent"
20+ android : layout_height =" wrap_content"
21+ android : layout_margin =" 8dp"
22+ app : bg_color =" @android:color/holo_blue_dark"
23+ app : btn_text =" Place Order" />
24+
25+ </LinearLayout >
Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ public class ProSwipeButton extends RelativeLayout {
5353 private static final int BTN_MORPHED_RADIUS = dpToPx (100 );
5454 private static final int MORPH_ANIM_DURATION = 500 ;
5555
56+ //// TODO: 26/10/17 Add touch blocking
57+
5658 /*
5759 User configurable settings
5860 */
You can’t perform that action at this time.
0 commit comments