2222import androidx .annotation .AttrRes ;
2323import androidx .annotation .ColorInt ;
2424import androidx .annotation .FloatRange ;
25+ import androidx .annotation .NonNull ;
2526import androidx .annotation .RestrictTo ;
2627import com .google .android .material .resources .MaterialAttributes ;
2728import 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