@@ -45,7 +45,7 @@ public ShapeBuilder Type(int type) {
4545 public ShapeBuilder Stroke (int px , int color ) {
4646 drawable .setStroke (px , color );
4747 if (container != null ) {
48- container .strokeWidth = px ;
48+ container .stokewidth = px ;
4949 container .stokeColor = color ;
5050 }
5151 return this ;
@@ -61,7 +61,7 @@ public ShapeBuilder Stroke(int px, int color) {
6161 public ShapeBuilder Stroke (int px , int color , int dashWidth , int dashGap ) {
6262 drawable .setStroke (px , color , dashWidth , dashGap );
6363 if (container != null ) {
64- container .strokeWidth = px ;
64+ container .stokewidth = px ;
6565 container .stokeColor = color ;
6666 container .dashWidth = dashWidth ;
6767 container .dashGap = dashGap ;
@@ -70,38 +70,44 @@ public ShapeBuilder Stroke(int px, int color, int dashWidth, int dashGap) {
7070 }
7171
7272 /**
73- * 使用Solid(int color)方法
73+ *
7474 * @param color -背景颜色
7575 */
76- @ Deprecated
7776 public ShapeBuilder Soild (int color ) {
7877 drawable .setColor (color );
7978 if (container != null ) {
80- container .solid = color ;
79+ container .soild = color ;
8180 }
8281 return this ;
8382 }
8483
8584 /**
8685 *
87- * @param color -背景颜色
86+ * @param px -圆角,四个角保持一致
8887 */
89- public ShapeBuilder Solid ( int color ) {
90- drawable .setColor ( color );
88+ public ShapeBuilder Radius ( float px ) {
89+ drawable .setCornerRadius ( px );
9190 if (container != null ) {
92- container .solid = color ;
91+ container .setRadius ( px , px , px , px ) ;
9392 }
9493 return this ;
9594 }
9695
9796 /**
97+ * 圆角
98+ * @param topleft 左上
99+ * @param topright 右上
100+ * @param botleft 左下
101+ * @param botright 右下
98102 *
99- * @param px -圆角,四个角保持一致
103+ * @Deprecated 左下和右下颠倒了,换用RoundRadius()方法
100104 */
101- public ShapeBuilder Radius (float px ) {
102- drawable .setCornerRadius (px );
105+ @ Deprecated
106+ public ShapeBuilder Radius (float topleft , float topright , float botleft , float botright ) {
107+ drawable .setCornerRadii (new float []{topleft , topleft , topright , topright , botleft ,
108+ botleft , botright , botright });
103109 if (container != null ) {
104- container .setRadius (px , px , px , px );
110+ container .setRadius (topleft , topright , botleft , botright );
105111 }
106112 return this ;
107113 }
@@ -113,9 +119,9 @@ public ShapeBuilder Radius(float px) {
113119 * @param botleft 左下
114120 * @param botright 右下
115121 */
116- public ShapeBuilder Radius (float topleft , float topright , float botleft , float botright ) {
117- drawable .setCornerRadii (new float []{topleft , topleft , topright , topright , botleft ,
118- botleft , botright , botright });
122+ public ShapeBuilder RoundRadius (float topleft , float topright , float botleft , float botright ) {
123+ drawable .setCornerRadii (new float []{topleft , topleft , topright , topright , botright ,
124+ botright , botleft , botleft });
119125 if (container != null ) {
120126 container .setRadius (topleft , topright , botleft , botright );
121127 }
@@ -231,6 +237,7 @@ public ShapeBuilder GradientInit(GradientDrawable.Orientation orientation, int..
231237 * @param type linear (default.)-LINEAR_GRADIENT
232238 * circular-RADIAL_GRADIENT
233239 * sweep-SWEEP_GRADIENT
240+ * @return
234241 */
235242 public ShapeBuilder GradientType (int type ) {
236243 drawable .setGradientType (type );
@@ -244,6 +251,7 @@ public ShapeBuilder GradientType(int type) {
244251 * 这两个属性只有在type不为linear情况下起作用。
245252 * @param x 相对X的渐变位置
246253 * @param y 相对Y的渐变位置
254+ * @return
247255 */
248256 public ShapeBuilder GradientCenter (float x , float y ) {
249257 drawable .setGradientCenter (x , y );
@@ -257,11 +265,12 @@ public ShapeBuilder GradientCenter(float x, float y) {
257265 /**
258266 * 该属性只有在type="radial"有效
259267 * @param radius 渐变颜色的半径
268+ * @return
260269 */
261270 public ShapeBuilder GradientRadius (float radius ) {
262271 drawable .setGradientRadius (radius );
263272 if (container != null ) {
264- container .gradientRadius = radius ;
273+ container .gradinetRadius = radius ;
265274 }
266275 return this ;
267276 }
@@ -270,6 +279,7 @@ public ShapeBuilder GradientRadius(float radius) {
270279 * 设置size
271280 * @param width 宽
272281 * @param height 高
282+ * @return
273283 */
274284 public ShapeBuilder setSize (int width , int height ) {
275285 drawable .setSize (width , height );
@@ -316,30 +326,30 @@ public GradientDrawable build() {
316326 private void operateMethod () {
317327 if (container != null ) {
318328 this .Type (container .type )
319- .Stroke (container .strokeWidth , container .stokeColor , container .dashWidth ,
329+ .Stroke (container .stokewidth , container .stokeColor , container .dashWidth ,
320330 container .dashGap )
321331 .Radius (container .topLeft ,container .topRight ,container .botLeft ,container .botRight )
322332 .setSize (container .width ,container .height )
323333 .GradientType (container .gradientType )
324334 .GradientCenter (container .gradientCenterX ,container .gradientCenterY )
325- .GradientRadius (container .gradientRadius );
326- if (container .solid != 0 ) {
327- Solid (container .solid );
335+ .GradientRadius (container .gradinetRadius );
336+ if (container .soild != 0 ) {
337+ Soild (container .soild );
328338 }
329339 }
330340 }
331341
332342 private class AttrContainer {
333343 public int type ;
334- public int strokeWidth ;
344+ public int stokewidth ;
335345 public int stokeColor ;
336346 public int dashWidth ;
337347 public int dashGap ;
338- public int solid ;
348+ public int soild ;
339349 public float topLeft , topRight , botLeft , botRight ;
340350 public int width , height ;
341351 public int gradientType ;
342- public float gradientRadius ;
352+ public float gradinetRadius ;
343353
344354 public float gradientCenterX , gradientCenterY ;
345355
0 commit comments