@@ -15,7 +15,7 @@ repositories {
1515}
1616
1717dependencies {
18- compile 'com.chaos.view:pinview:1.1 .0'
18+ compile 'com.chaos.view:pinview:1.2 .0'
1919}
2020```
2121
@@ -30,20 +30,22 @@ Add PinView in your layout.
3030``` xml
3131<com .chaos.view.PinView
3232 android : id =" @+id/pinView"
33+ style =" @style/PinWidget.PinView"
3334 android : layout_width =" wrap_content"
3435 android : layout_height =" wrap_content"
35- android : inputType = " number "
36- android : padding = " 5dp "
37- android : text = " 12345 "
36+ android : hint = " Hint. "
37+ android : inputType = " text "
38+ android : padding = " @dimen/common_padding "
3839 android : textColor =" @color/text_colors"
3940 android : textSize =" 18sp"
40- app : borderColor =" @color/border_colors"
41- app : borderWidth =" 2dp"
4241 app : itemCount =" 5"
43- app : itemSize =" 48dp"
44- app : itemSpacing =" 4dp"
42+ app : itemHeight =" 48dp"
4543 app : itemRadius =" 4dp"
46- style =" @style/PinWidget.PinView" />
44+ app : itemSpacing =" 0dp"
45+ app : itemWidth =" 36dp"
46+ app : lineColor =" @color/line_colors"
47+ app : lineWidth =" 2dp"
48+ app : viewType =" rectangle" />
4749```
4850
4951#### Java
@@ -53,16 +55,17 @@ PinView pinView = (PinView) findViewById(R.id.secondPinView);
5355pinView. setTextColor(
5456 ResourcesCompat . getColor(getResources(), R . color. colorAccent, getTheme()));
5557pinView. setTextColor(
56- ResourcesCompat . getColorStateList(getResources(), R . color. text_colors , getTheme()));
57- pinView. setBorderColor (
58+ ResourcesCompat . getColorStateList(getResources(), R . color. line_colors , getTheme()));
59+ pinView. setLineColor (
5860 ResourcesCompat . getColor(getResources(), R . color. colorPrimary, getTheme()));
59- pinView. setBorderColor(
60- ResourcesCompat . getColorStateList(getResources(), R . color. border_colors, getTheme()));
61- pinView. setItemCount(5 );
62- pinView. setItemSize(getResources(). getDimensionPixelSize(R . dimen. pv_pin_view_box_height));
63- pinView. setItemRadius(getResources(). getDimensionPixelSize(R . dimen. pv_pin_view_box_radius));
64- pinView. setItemSpacing(getResources(). getDimensionPixelSize(R . dimen. pv_pin_view_box_margin));
65- pinView. setBorderWidth(getResources(). getDimensionPixelSize(R . dimen. pv_pin_view_box_border_width));
61+ pinView. setLineColor(
62+ ResourcesCompat . getColorStateList(getResources(), R . color. text_colors, getTheme()));
63+ pinView. setItemCount(4 );
64+ pinView. setItemHeight(getResources(). getDimensionPixelSize(R . dimen. pv_pin_view_item_size));
65+ pinView. setItemWidth(getResources(). getDimensionPixelSize(R . dimen. pv_pin_view_item_size));
66+ pinView. setItemRadius(getResources(). getDimensionPixelSize(R . dimen. pv_pin_view_item_radius));
67+ pinView. setItemSpacing(getResources(). getDimensionPixelSize(R . dimen. pv_pin_view_item_spacing));
68+ pinView. setLineWidth(getResources(). getDimensionPixelSize(R . dimen. pv_pin_view_item_line_width));
6669pinView. setAnimationEnable(true );// start animation when adding text
6770```
6871
@@ -77,7 +80,7 @@ Specifies `pinViewStyle` in your theme,
7780</style >
7881```
7982
80- or implement ` PinWidget.PinView ` style.
83+ or use the ` PinWidget.PinView ` style.
8184
8285``` xml
8386<com .chaos.view.PinView
@@ -87,6 +90,19 @@ or implement `PinWidget.PinView` style.
8790 style =" @style/PinWidget.PinView" />
8891```
8992
93+ ## Attributes
94+
95+ * ** itemSize** , @deprecated use itemWidth or itemHeight instead.
96+ * ** borderWidth** , @deprecated use lineWidth instead.
97+ * ** borderColor** , @deprecated use lineColor instead.
98+ * ** itemCount** , the length of your pin code.
99+ * ** itemWidth** , the width of each item.
100+ * ** itemHeight** , the height of each item.
101+ * ** itemSpacing** , the spacing between two items.
102+ * ** lineWidth** , the line(border) width.
103+ * ** lineColor** , the line(border) colors.
104+ * ** viewType** , the view type of PinView, currently this will be one of ` rectangle ` or ` line ` .
105+
90106## Thanks
91107
92108 * Inspired by [ PasswordInput] ( https://github.com/EthanCo/PasswordInput ) in [ EthanCo] ( https://github.com/EthanCo )
0 commit comments