Skip to content

Commit 2f9a00f

Browse files
committed
Merge remote-tracking branch 'pl.sigmapoint.view.CustomButton/master' into develop
2 parents 18be9ff + 4024182 commit 2f9a00f

File tree

1 file changed

+75
-72
lines changed

1 file changed

+75
-72
lines changed

README.md

Lines changed: 75 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
<h1> Sigmapoint Custom Button </h1>
1+
# Sigmapoint Custom Button
22

3-
<p> If you want start use this button, you must clone or download this repository. <br>
4-
Next in Android Studio File -> New -> Import module.
5-
Then select library folder from project. And start use. </p>
6-
<p> >=API 8 </p>
3+
To start work with CustomButton you should clone or download this repository.
4+
Next in Android Studio choose File -> New -> Import module.
5+
Then select library folder in project and click import. </p>
6+
```
7+
min API 8
8+
```
79

8-
<h2> Features </h2>
10+
## Features
911

10-
* Use only custom tags in button declaration and reach state colors of text, background, frame and drawable.
11-
* Add only one image and change it color dynamically
12-
* Text color for normal, pressed and disabled state
13-
* Background color for normal, pressed and disabled state
14-
* Frame color for normal, pressed and disabled state
15-
* Drawable color for normal, pressed and disabled state
16-
* Specify image position and text will be centered with relation to whole button
12+
* Use only cb tags to change state colors of text, background, frame and drawable
13+
* Add only one drawable and change it color dynamically
14+
* Set text, background, frame and drawable color for normal, pressed and disabled state
15+
* Image nad text position will be centered with relation to whole button
1716

1817
Example:
1918

2019
![](https://github.com/Sigmapoint/pl.sigmapoint.view.CustomButton/blob/develop/resources/screen_2.png)
2120

22-
For creating facebook button you must only do this:
21+
Custom Facebook button:
2322
```xml
2423
<pl.sigmapoint.customview.CustomButton
2524
android:layout_width="match_parent"
@@ -38,67 +37,68 @@ For creating facebook button you must only do this:
3837
app:cb_text_color="#FFFFFF" />
3938
```
4039

41-
<h2> Reference </h2>
42-
<p> Default image position is left and centered text in button. <br>
43-
When image is bigger than half of width, weight automatically is setting to 1. <br>
44-
Only when image is in horizontal position text can be center. </p>
45-
<h3> XML tag's </h3>
40+
## Reference
41+
Default image position is left. Default text position is center.
42+
When image is bigger than half of width, then weight automatically is setting to 1.
43+
Only when image is in horizontal position text can be center.
44+
### XML tag's
4645

47-
This is the base tag of CustomButton:<br>
46+
This is the base tag of CustomButton:
4847
```xml
4948
<pl.sigmapoint.customview.CustomButton
5049
android:id="@+id/sigmapoint_button"
5150
android:layout_width="match_parent"
5251
android:layout_height="match_parent"
5352
android:text="text"/>
5453
```
55-
<p> You can specify the following things: <br>
56-
cb_primary_color - you can specify only two colors for all button. This color was set to bacground state normal, <br>
57-
frame and text sate pressed. But it will be override by background, text, frame color. {format - color} <br>
58-
cb_secondary_color - you can specify only two colors for all button. This color was set to bacground state pressed, <br> frame and text state normal. But it will be override by background, text, frame color. {format - color} <br>
59-
cb_background - background color of normal button {format - color} <br>
60-
cb_background_pressed - background color of pressed button {format - color} <br>
61-
cb_background_disabled - background color of disabled button {format - color} <br>
62-
cb_background_state_list - {format - ColorStateList} <br>
63-
<br>
64-
cb_text_color_pressed - color of pressed text {format - color} <br>
65-
cb_text_color_disabled - color of disabled text {format - color} <br>
66-
cb_text_color or android:textColor - color of normal text {format - color} <br>
67-
cb_text_size - {format - dimension} <br>
68-
cb_text_padding - {format - dimension} <br>
69-
cb_text_padding_left - {format - dimension} <br>
70-
cb_text_padding_top - {format - dimension} <br>
71-
cb_text_padding_right - {format - dimension} <br>
72-
cb_text_padding_bottom - {format - dimension} <br>
73-
cb_text_weight - {format - integer} <br>
74-
cb_text_center or android:textAlignment - only works when image weight doesn't specify. Center text in button. {format - boolean or only "center" value} <br>
75-
<br>
76-
cb_shape_radius - corner radius {format - dimension}<br>
77-
cb_shape_type - shape type, you can choose: rect or oval <br>
78-
cb_frame_color - {format - color} <br>
79-
cb_frame_color_pressed - {format - color} <br>
80-
cb_frame_color_disabled - {format - color} <br>
81-
cb_frame_size - frame height {format - dimension} <br>
82-
cb_frame_state_list - {format - ColorStateList} <br>
83-
<br>
84-
cb_elevation_enabled - on >=API 21 devices enable elvation (default) {format - boolean} <br>
85-
<br>
86-
cb_image_position - image position in button, can choose left, top, right, bottom <br>
87-
cb_image - image source {format - drawable or color} <br>
88-
cb_image_normal - normal state image source (if you choose cb_image, it will be override) {format - drawable or color} <br>
89-
cb_image_disabled - disabled state image source (if you choose cb_image, it will be override) {format - drawable or color} <br>
90-
cb_image_pressed - pressed state image source (if you choose cb_image, it will be override) {format - drawable or color} <br>
91-
cb_image_color_normal - only for image {format - color} <br>
92-
cb_image_color_pressed - only for image {format - color} <br>
93-
cb_image_color_disable - only for image {format - color} <br>
94-
cb_image_color_list - only for image {format - colorStateList} <br>
95-
cb_image_padding - {format - dimension} <br>
96-
cb_image_padding_left - {format - dimension} <br>
97-
cb_image_padding_top - {format - dimension} <br>
98-
cb_image_padding_right - {format - dimension} <br>
99-
cb_image_padding_bottom - {format - dimension} <br>
100-
cb_image_scale_type - {center, center_inside, center_crop, fit_center, fit_start, fit_end, fit_xy} <br>
101-
cb_image_weight - {format - integer} </p>
54+
You can specify the following things:
55+
```
56+
cb_primary_color - you can specify only two colors for all button. This color was set to bacground state normal,
57+
frame and text sate pressed. But it will be override by background, text, frame color. {format - color}
58+
cb_secondary_color - you can specify only two colors for all button. This color was set to bacground state pressed, frame and text state normal. But it will be override by background, text, frame color. {format - color}
59+
cb_background - background color of normal button {format - color}
60+
cb_background_pressed - background color of pressed button {format - color}
61+
cb_background_disabled - background color of disabled button {format - color}
62+
cb_background_state_list - {format - ColorStateList}
63+
cb_text_color_pressed - color of pressed text {format - color}
64+
cb_text_color_disabled - color of disabled text {format - color}
65+
cb_text_color or android:textColor - color of normal text {format - color}
66+
cb_text_size - {format - dimension}
67+
cb_text_padding - {format - dimension}
68+
cb_text_padding_left - {format - dimension}
69+
cb_text_padding_top - {format - dimension}
70+
cb_text_padding_right - {format - dimension}
71+
cb_text_padding_bottom - {format - dimension}
72+
cb_text_weight - {format - integer}
73+
cb_text_center or android:textAlignment - only works when image weight doesn't specify. Center text in button. {format - boolean or only "center" value}
74+
75+
cb_shape_radius - corner radius {format - dimension}
76+
cb_shape_type - shape type, you can choose: rect or oval
77+
cb_frame_color - {format - color}
78+
cb_frame_color_pressed - {format - color}
79+
cb_frame_color_disabled - {format - color}
80+
cb_frame_size - frame height {format - dimension}
81+
cb_frame_state_list - {format - ColorStateList}
82+
83+
cb_elevation_enabled - on >=API 21 devices enable elvation (default) {format - boolean}
84+
85+
cb_image_position - image position in button, can choose left, top, right, bottom
86+
cb_image - image source {format - drawable or color}
87+
cb_image_normal - normal state image source (if you choose cb_image, it will be override) {format - drawable or color}
88+
cb_image_disabled - disabled state image source (if you choose cb_image, it will be override) {format - drawable or color}
89+
cb_image_pressed - pressed state image source (if you choose cb_image, it will be override) {format - drawable or color}
90+
cb_image_color_normal - only for image {format - color}
91+
cb_image_color_pressed - only for image {format - color}
92+
cb_image_color_disable - only for image {format - color}
93+
cb_image_color_list - only for image {format - colorStateList}
94+
cb_image_padding - {format - dimension}
95+
cb_image_padding_left - {format - dimension}
96+
cb_image_padding_top - {format - dimension}
97+
cb_image_padding_right - {format - dimension}
98+
cb_image_padding_bottom - {format - dimension}
99+
cb_image_scale_type - {center, center_inside, center_crop, fit_center, fit_start, fit_end, fit_xy}
100+
cb_image_weight - {format - integer}
101+
```
102102
<h3> Java Code </h3>
103103
```java
104104
CustomButton(Context context, LayoutParams layoutParams, int primaryColor, int secondaryColor, Drawable icon)
@@ -139,12 +139,15 @@ setImageDisableColor(int color)
139139
setElevationEnabled(boolean enabled)
140140
and evry XML tag have getter
141141
```
142-
<h3> Static field </h3>
142+
### Static field
143143
LEFT, TOP, RIGHT, BOTTOM - for image position
144144

145-
<h3> Tips </h3>
146-
If you add image to the button, set frame and want to center text without respect frame you should set text padding same as frame size.
145+
#### Tips
146+
If you add image to the button, set frame and want to center text without respect frame size you should set text padding same as frame size.
147147

148-
<h2> Dependencies </h2>
148+
## Dependencies
149149
In demo application [Ambil Warna](https://github.com/yukuku/ambilwarna) Library was used.
150-
150+
151+
##License
152+
153+
CustomButton is licensed under the MIT license. (http://opensource.org/licenses/MIT)

0 commit comments

Comments
 (0)