// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static int resolveAttribute(final View view, @AttrRes final int attr) {
//   final TypedValue value = new TypedValue();
//   view.getContext().getTheme().resolveAttribute(attr, value, true);
//   return value.data;
// }


import android.graphics.Color;
import androidx.annotation.AttrRes;
import androidx.annotation.CheckResult;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.Nullable;
import androidx.test.espresso.matcher.BoundedMatcher;
import android.view.View;
import android.widget.TextView;
import org.hamcrest.Description;
import static com.vanniktech.espresso.core.utils.Utils.resolveAttribute;
   * <p>Example usage:</p>
   * <code>onView(withId(R.id.view)).check(matches(withColorButtonNormal(RED)));</code>
   */
  @CheckResult public static AttributeMatcher withColorButtonNormal(@ColorInt final int color) {
    return new AttributeMatcher(R.attr.colorButtonNormal, "colorButtonNormal", ColorChecker.from(color));
  }

  /**
   * Matches that the button color has the expected color.
   *
   * <p>Example usage:</p>
   * <code>onView(withId(R.id.view)).check(matches(withColorButtonNormal("#ff0000")));</code>
   */
  @CheckResult public static AttributeMatcher withColorButtonNormal(final String color) {
    return withColorButtonNormal(Color.parseColor(color));
  }

  @AttrRes private final int attr;
  @Nullable private final String name;
  private final ColorChecker colorChecker;

  private AttributeMatcher(final int attr, @Nullable final String name, final ColorChecker colorChecker) {
    super(TextView.class);

    this.name = name;
    this.colorChecker = colorChecker;
    this.attr = attr;
  }

  @Override protected boolean matchesSafely(final TextView item) {
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static int resolveAttribute(final View view, @AttrRes final int attr) {
//   final TypedValue value = new TypedValue();
//   view.getContext().getTheme().resolveAttribute(attr, value, true);
//   return value.data;
// }


// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/AttributeMatcher.java
import android.graphics.Color;
import androidx.annotation.AttrRes;
import androidx.annotation.CheckResult;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.Nullable;
import androidx.test.espresso.matcher.BoundedMatcher;
import android.view.View;
import android.widget.TextView;
import org.hamcrest.Description;
import static com.vanniktech.espresso.core.utils.Utils.resolveAttribute;

   * <p>Example usage:</p>
   * <code>onView(withId(R.id.view)).check(matches(withColorButtonNormal(RED)));</code>
   */
  @CheckResult public static AttributeMatcher withColorButtonNormal(@ColorInt final int color) {
    return new AttributeMatcher(R.attr.colorButtonNormal, "colorButtonNormal", ColorChecker.from(color));
  }

  /**
   * Matches that the button color has the expected color.
   *
   * <p>Example usage:</p>
   * <code>onView(withId(R.id.view)).check(matches(withColorButtonNormal("#ff0000")));</code>
   */
  @CheckResult public static AttributeMatcher withColorButtonNormal(final String color) {
    return withColorButtonNormal(Color.parseColor(color));
  }

  @AttrRes private final int attr;
  @Nullable private final String name;
  private final ColorChecker colorChecker;

  private AttributeMatcher(final int attr, @Nullable final String name, final ColorChecker colorChecker) {
    super(TextView.class);

    this.name = name;
    this.colorChecker = colorChecker;
    this.attr = attr;
  }

  @Override protected boolean matchesSafely(final TextView item) {
    final int color = resolveAttribute(item, attr);