Skip to content

Commit 17195e4

Browse files
afohrmanikim24
authored andcommitted
Add documentation to public methods in ShapeAppearanceModel.
Some public methods were missing documentation. Also remove unnecessary hyphenation from methods that used hyphenation to describe the corner treatment positioning (ex: top-left -> top left). PiperOrigin-RevId: 239882358
1 parent 41274dd commit 17195e4

File tree

1 file changed

+46
-20
lines changed

1 file changed

+46
-20
lines changed

lib/java/com/google/android/material/shape/ShapeAppearanceModel.java

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ public ShapeAppearanceModel(
156156
a.recycle();
157157
}
158158

159+
/**
160+
* Sets all corner treatments to {@link CornerTreatment}s generated from a {@code cornerFamily}
161+
* and {@code cornerSize}.
162+
*
163+
* @param cornerFamily The family to be used to create the {@link CornerTreatment}s for all four
164+
* corners. May be one of {@link CornerFamily#ROUNDED} or {@link CornerFamily#CUT}.
165+
* @param cornerSize The size to be used to create the {@link CornerTreatment}s for all four
166+
* corners.
167+
*/
159168
public void setAllCorners(@CornerFamily int cornerFamily, @Dimension int cornerSize) {
160169
setAllCorners(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize));
161170
}
@@ -176,10 +185,27 @@ public void setAllCorners(CornerTreatment cornerTreatment) {
176185
}
177186
}
178187

188+
/**
189+
* Sets the corner size of all four corner treatments to {@code cornerRadius}. This is a
190+
* convenience method for {@link #setCornerRadii(float, float, float, float)})}.
191+
*
192+
* <p>Note: This method does not create new {@link CornerTreatment}s for all four corners.
193+
* Instead, it directly modifies the corner size of each existing corner treatment.
194+
*
195+
* @see #setCornerRadii(float, float, float, float)
196+
*/
179197
public void setCornerRadius(float cornerRadius) {
180198
setCornerRadii(cornerRadius, cornerRadius, cornerRadius, cornerRadius);
181199
}
182200

201+
/**
202+
* Sets the corner size of all four corner treatments using the {@code topLeftCornerRadius},
203+
* {@code topRightCornerRadius}, {@code bottomRightCornerRadius}, and {@code
204+
* bottomLeftCornerRadius}.
205+
*
206+
* <p>Note: This method does not create new {@link CornerTreatment}s for all four corners.
207+
* Instead, it directly modifies the corner size of each existing corner treatment.
208+
*/
183209
public void setCornerRadii(
184210
float topLeftCornerRadius,
185211
float topRightCornerRadius,
@@ -250,10 +276,10 @@ public void setAllEdges(EdgeTreatment edgeTreatment) {
250276
/**
251277
* Sets corner treatments.
252278
*
253-
* @param topLeftCorner the corner treatment to use in the top-left corner.
254-
* @param topRightCorner the corner treatment to use in the top-right corner.
255-
* @param bottomRightCorner the corner treatment to use in the bottom-right corner.
256-
* @param bottomLeftCorner the corner treatment to use in the bottom-left corner.
279+
* @param topLeftCorner the corner treatment to use in the top left corner.
280+
* @param topRightCorner the corner treatment to use in the top right corner.
281+
* @param bottomRightCorner the corner treatment to use in the bottom right corner.
282+
* @param bottomLeftCorner the corner treatment to use in the bottom left corner.
257283
*/
258284
public void setCornerTreatments(
259285
CornerTreatment topLeftCorner,
@@ -294,7 +320,7 @@ public void setEdgeTreatments(
294320
}
295321

296322
/**
297-
* Sets the corner treatment for the top-left corner.
323+
* Sets the corner treatment for the top left corner.
298324
*
299325
* @param cornerFamily the family to use to create the corner treatment
300326
* @param cornerSize the size to use to create the corner treatment
@@ -304,7 +330,7 @@ public void setTopLeftCorner(@CornerFamily int cornerFamily, @Dimension int corn
304330
}
305331

306332
/**
307-
* Sets the corner treatment for the top-left corner.
333+
* Sets the corner treatment for the top left corner.
308334
*
309335
* @param topLeftCorner the desired treatment.
310336
*/
@@ -324,16 +350,16 @@ private boolean setTopLeftCornerInternal(CornerTreatment topLeftCorner) {
324350
}
325351

326352
/**
327-
* Gets the corner treatment for the top-left corner.
353+
* Gets the corner treatment for the top left corner.
328354
*
329-
* @return the corner treatment for the top-left corner.
355+
* @return the corner treatment for the top left corner.
330356
*/
331357
public CornerTreatment getTopLeftCorner() {
332358
return topLeftCorner;
333359
}
334360

335361
/**
336-
* Sets the corner treatment for the top-right corner.
362+
* Sets the corner treatment for the top right corner.
337363
*
338364
* @param cornerFamily the family to use to create the corner treatment
339365
* @param cornerSize the size to use to create the corner treatment
@@ -343,7 +369,7 @@ public void setTopRightCorner(@CornerFamily int cornerFamily, @Dimension int cor
343369
}
344370

345371
/**
346-
* Sets the corner treatment for the top-right corner.
372+
* Sets the corner treatment for the top right corner.
347373
*
348374
* @param topRightCorner the desired treatment.
349375
*/
@@ -363,16 +389,16 @@ private boolean setTopRightCornerInternal(CornerTreatment topRightCorner) {
363389
}
364390

365391
/**
366-
* Gets the corner treatment for the top-right corner.
392+
* Gets the corner treatment for the top right corner.
367393
*
368-
* @return the corner treatment for the top-right corner.
394+
* @return the corner treatment for the top right corner.
369395
*/
370396
public CornerTreatment getTopRightCorner() {
371397
return topRightCorner;
372398
}
373399

374400
/**
375-
* Sets the corner treatment for the bottom-right corner.
401+
* Sets the corner treatment for the bottom right corner.
376402
*
377403
* @param cornerFamily the family to use to create the corner treatment
378404
* @param cornerSize the size to use to create the corner treatment
@@ -382,7 +408,7 @@ public void setBottomRightCorner(@CornerFamily int cornerFamily, @Dimension int
382408
}
383409

384410
/**
385-
* Sets the corner treatment for the bottom-right corner.
411+
* Sets the corner treatment for the bottom right corner.
386412
*
387413
* @param bottomRightCorner the desired treatment.
388414
*/
@@ -402,16 +428,16 @@ private boolean setBottomRightCornerInternal(CornerTreatment bottomRightCorner)
402428
}
403429

404430
/**
405-
* Gets the corner treatment for the bottom-right corner.
431+
* Gets the corner treatment for the bottom right corner.
406432
*
407-
* @return the corner treatment for the bottom-right corner.
433+
* @return the corner treatment for the bottom right corner.
408434
*/
409435
public CornerTreatment getBottomRightCorner() {
410436
return bottomRightCorner;
411437
}
412438

413439
/**
414-
* Sets the corner treatment for the bottom-left corner.
440+
* Sets the corner treatment for the bottom left corner.
415441
*
416442
* @param cornerFamily the family to use to create the corner treatment
417443
* @param cornerSize the size to use to create the corner treatment
@@ -421,7 +447,7 @@ public void setBottomLeftCorner(@CornerFamily int cornerFamily, @Dimension int c
421447
}
422448

423449
/**
424-
* Sets the corner treatment for the bottom-left corner.
450+
* Sets the corner treatment for the bottom left corner.
425451
*
426452
* @param bottomLeftCorner the desired treatment.
427453
*/
@@ -441,9 +467,9 @@ private boolean setBottomLeftCornerInternal(CornerTreatment bottomLeftCorner) {
441467
}
442468

443469
/**
444-
* Gets the corner treatment for the bottom-left corner.
470+
* Gets the corner treatment for the bottom left corner.
445471
*
446-
* @return the corner treatment for the bottom-left corner.
472+
* @return the corner treatment for the bottom left corner.
447473
*/
448474
public CornerTreatment getBottomLeftCorner() {
449475
return bottomLeftCorner;

0 commit comments

Comments
 (0)