|
| 1 | +# ProgressButtonLib |
| 2 | +[](https://jitpack.io/#shashifreeze/ProgressButtonLib) |
| 3 | + |
| 4 | +Progress Button for android projects. |
| 5 | + |
| 6 | +<b>About progress button:</b> |
| 7 | + |
| 8 | +There are two buttons this library provides |
| 9 | + |
| 10 | +1> PorgressButton |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +2> ProgressLoadingButton |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +Attributes for ProgressButton are: |
| 21 | + |
| 22 | +```XML |
| 23 | + <attr name="pb_text_color" format="color|reference" /> |
| 24 | + <attr name="pb_start_bg_color" format="color|reference" /> |
| 25 | + <attr name="pb_progress_color" format="color|reference" /> |
| 26 | + <attr name="pb_text_size" format="dimension|reference" /> |
| 27 | + <attr name="pb_before_progress_text" format="string" /> |
| 28 | + <attr name="pb_on_progress_text" format="string" /> |
| 29 | + <attr name="pb_after_progress_text" format="string" /> |
| 30 | + <attr name="pb_text_gravity" format="integer"/> |
| 31 | +``` |
| 32 | +Attributes for ProgressLoadingButton are: |
| 33 | + |
| 34 | +```XML |
| 35 | + <attr name="plb_text_color" format="color|reference" /> |
| 36 | + <attr name="plb_start_bg_color" format="color|reference" /> |
| 37 | + <attr name="plb_progress_color" format="color|reference" /> |
| 38 | + <attr name="plb_text_size" format="dimension|reference" /> |
| 39 | + <attr name="plb_before_progress_text" format="string" /> |
| 40 | + <attr name="plb_after_progress_text" format="string" /> |
| 41 | + <attr name="plb_text_gravity" format="integer"/> |
| 42 | +``` |
| 43 | + |
| 44 | +<b>How to use ProgressButton?</b> |
| 45 | + |
| 46 | +Add in yout activity or fragment XML layout file: |
| 47 | + |
| 48 | +```XML |
| 49 | +<com.shashifreeze.progressbutton.ProgressButton |
| 50 | + android:layout_width="match_parent" |
| 51 | + android:layout_margin="10dp" |
| 52 | + android:id="@+id/pb" |
| 53 | + android:gravity="center" |
| 54 | + app:cardBackgroundColor="@color/black" |
| 55 | + app:cardCornerRadius="6dp" |
| 56 | + app:pb_text_color = "@color/white" |
| 57 | + app:pb_text_gravity = "1" |
| 58 | + app:plb_text_size = "6sp" |
| 59 | + app:pb_progress_color = "@color/white" |
| 60 | + app:pb_before_progress_text = "ProgressButton" |
| 61 | + android:layout_height="wrap_content" /> |
| 62 | +``` |
| 63 | + |
| 64 | +In your java or kotlin file: |
| 65 | + |
| 66 | +To start showing loading progress bar inside the button use method |
| 67 | +```XML |
| 68 | +startProgress("Your to show while loading","background color") |
| 69 | +``` |
| 70 | +To stop showing loading progress bar inside the button use method |
| 71 | +```XML |
| 72 | +stopProgress("Your text to show after loading ends","background color") |
| 73 | +``` |
| 74 | + |
| 75 | +<b>How to use ProgressLoadingButton?</b> |
| 76 | + |
| 77 | +Add in yout activity or fragment XML layout file: |
| 78 | + |
| 79 | +```XML |
| 80 | + <com.shashifreeze.progressbutton.ProgressLoadingButton |
| 81 | + android:layout_width="match_parent" |
| 82 | + android:layout_margin="10dp" |
| 83 | + android:id="@+id/plb_btn" |
| 84 | + android:gravity="center" |
| 85 | + app:cardBackgroundColor="@color/black" |
| 86 | + app:cardCornerRadius="6dp" |
| 87 | + app:plb_text_color = "@color/white" |
| 88 | + app:plb_text_gravity = "1" |
| 89 | + app:plb_progress_color = "@color/black" |
| 90 | + app:plb_text_size = "6sp" |
| 91 | + app:plb_before_progress_text = "ProgressLoadingButton" |
| 92 | + android:layout_height="wrap_content" /> |
| 93 | +``` |
| 94 | + |
| 95 | +In your java or kotlin file: |
| 96 | + |
| 97 | +To start showing loading progress bar inside the button use method |
| 98 | +```XML |
| 99 | +startProgress("background color") |
| 100 | +``` |
| 101 | +To stop showing loading progress bar inside the button use method |
| 102 | +```XML |
| 103 | +stopProgress("Your text to show after loading ends","background color") |
| 104 | +``` |
| 105 | + |
| 106 | +See example here |
| 107 | +https://github.com/shashifreeze/ProgressButtonLib/blob/master/app/src/main/java/com/shashifreeze/progressbuttonlib/MainActivity.kt |
0 commit comments