Skip to content

Commit c60fbda

Browse files
cketchamwcshi
authored andcommitted
Add @nonnull and @nullable annotations
PiperOrigin-RevId: 264615617
1 parent 5f331fd commit c60fbda

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

lib/java/com/google/android/material/color/MaterialColors.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import androidx.annotation.AttrRes;
2323
import androidx.annotation.ColorInt;
2424
import androidx.annotation.FloatRange;
25+
import androidx.annotation.NonNull;
2526
import androidx.annotation.RestrictTo;
2627
import com.google.android.material.resources.MaterialAttributes;
2728
import androidx.core.graphics.ColorUtils;
@@ -49,7 +50,7 @@ public class MaterialColors {
4950
* @throws IllegalArgumentException if the attribute is not set in the current theme.
5051
*/
5152
@ColorInt
52-
public static int getColor(View view, @AttrRes int colorAttributeResId) {
53+
public static int getColor(@NonNull View view, @AttrRes int colorAttributeResId) {
5354
return MaterialAttributes.resolveOrThrow(view, colorAttributeResId);
5455
}
5556

@@ -70,7 +71,7 @@ public static int getColor(
7071
*/
7172
@ColorInt
7273
public static int getColor(
73-
View view, @AttrRes int colorAttributeResId, @ColorInt int defaultValue) {
74+
@NonNull View view, @AttrRes int colorAttributeResId, @ColorInt int defaultValue) {
7475
return getColor(view.getContext(), colorAttributeResId, defaultValue);
7576
}
7677

@@ -80,7 +81,7 @@ public static int getColor(
8081
*/
8182
@ColorInt
8283
public static int getColor(
83-
Context context, @AttrRes int colorAttributeResId, @ColorInt int defaultValue) {
84+
@NonNull Context context, @AttrRes int colorAttributeResId, @ColorInt int defaultValue) {
8485
TypedValue typedValue = MaterialAttributes.resolve(context, colorAttributeResId);
8586
if (typedValue != null) {
8687
return typedValue.data;
@@ -95,7 +96,7 @@ public static int getColor(
9596
*/
9697
@ColorInt
9798
public static int layer(
98-
View view,
99+
@NonNull View view,
99100
@AttrRes int backgroundColorAttributeResId,
100101
@AttrRes int overlayColorAttributeResId) {
101102
return layer(view, backgroundColorAttributeResId, overlayColorAttributeResId, 1f);
@@ -107,7 +108,7 @@ public static int layer(
107108
*/
108109
@ColorInt
109110
public static int layer(
110-
View view,
111+
@NonNull View view,
111112
@AttrRes int backgroundColorAttributeResId,
112113
@AttrRes int overlayColorAttributeResId,
113114
@FloatRange(from = 0.0, to = 1.0) float overlayAlpha) {

0 commit comments

Comments
 (0)