// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int INDEX_BOTTOM = 3;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int INDEX_LEFT = 0;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int INDEX_RIGHT = 2;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int INDEX_TOP = 1;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int NO_DRAWABLE = -1;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static boolean drawableMatches(final View view, final Drawable drawable, @DrawableRes final int expectedId) {
//   final boolean isVisible = view.getVisibility() == VISIBLE;
// 
//   if (expectedId == NO_DRAWABLE) {
//     return isVisible && drawable == null;
//   }
// 
//   final Context context = view.getContext();
//   return isVisible && checkNotNull(drawable.getConstantState(), "constantState == null").equals(ContextCompat.getDrawable(context, expectedId).getConstantState());
// }


import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.graphics.drawable.Drawable;
import androidx.annotation.CheckResult;
import androidx.annotation.DrawableRes;
import androidx.test.espresso.matcher.BoundedMatcher;
import android.view.View;
import android.widget.TextView;
import org.hamcrest.Description;
import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_BOTTOM;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_LEFT;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RELATIVE_BOTTOM;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RELATIVE_LEFT;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RELATIVE_RIGHT;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RELATIVE_TOP;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RIGHT;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_TOP;
import static com.vanniktech.espresso.core.utils.Utils.INDEX_BOTTOM;
import static com.vanniktech.espresso.core.utils.Utils.INDEX_LEFT;
import static com.vanniktech.espresso.core.utils.Utils.INDEX_RIGHT;
import static com.vanniktech.espresso.core.utils.Utils.INDEX_TOP;
import static com.vanniktech.espresso.core.utils.Utils.NO_DRAWABLE;
import static com.vanniktech.espresso.core.utils.Utils.drawableMatches;

  private TextViewDrawableMatcher(final int expectedId, final Type type) {
    super(TextView.class);

    this.expectedId = expectedId;
    this.type = type;
  }

  @Override protected boolean matchesSafely(final TextView textView) {
    return drawableMatches(textView, type.getDrawable(textView), expectedId);
  }

  @Override public void describeTo(final Description description) {
    if (expectedId == NO_DRAWABLE) {
      description.appendText("with no ")
          .appendText(type.string)
          .appendText(" drawable");
    } else {
      description.appendText("with ")
          .appendText(type.string)
          .appendText(" drawable from resource id: ")
          .appendValue(expectedId);
    }
  }

  enum Type {
    DRAWABLE_LEFT(INDEX_LEFT, false, "left"),
    DRAWABLE_RELATIVE_LEFT(INDEX_LEFT, true, "relative left"),
    DRAWABLE_TOP(INDEX_TOP, false, "top"),
    DRAWABLE_RELATIVE_TOP(INDEX_TOP, true, "relative top"),
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int INDEX_BOTTOM = 3;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int INDEX_LEFT = 0;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int INDEX_RIGHT = 2;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int INDEX_TOP = 1;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static final int NO_DRAWABLE = -1;
// 
// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/Utils.java
// static boolean drawableMatches(final View view, final Drawable drawable, @DrawableRes final int expectedId) {
//   final boolean isVisible = view.getVisibility() == VISIBLE;
// 
//   if (expectedId == NO_DRAWABLE) {
//     return isVisible && drawable == null;
//   }
// 
//   final Context context = view.getContext();
//   return isVisible && checkNotNull(drawable.getConstantState(), "constantState == null").equals(ContextCompat.getDrawable(context, expectedId).getConstantState());
// }


// Path: espresso-core-utils/src/main/java/com/vanniktech/espresso/core/utils/TextViewDrawableMatcher.java
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.graphics.drawable.Drawable;
import androidx.annotation.CheckResult;
import androidx.annotation.DrawableRes;
import androidx.test.espresso.matcher.BoundedMatcher;
import android.view.View;
import android.widget.TextView;
import org.hamcrest.Description;
import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_BOTTOM;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_LEFT;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RELATIVE_BOTTOM;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RELATIVE_LEFT;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RELATIVE_RIGHT;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RELATIVE_TOP;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_RIGHT;
import static com.vanniktech.espresso.core.utils.TextViewDrawableMatcher.Type.DRAWABLE_TOP;
import static com.vanniktech.espresso.core.utils.Utils.INDEX_BOTTOM;
import static com.vanniktech.espresso.core.utils.Utils.INDEX_LEFT;
import static com.vanniktech.espresso.core.utils.Utils.INDEX_RIGHT;
import static com.vanniktech.espresso.core.utils.Utils.INDEX_TOP;
import static com.vanniktech.espresso.core.utils.Utils.NO_DRAWABLE;
import static com.vanniktech.espresso.core.utils.Utils.drawableMatches;


  private TextViewDrawableMatcher(final int expectedId, final Type type) {
    super(TextView.class);

    this.expectedId = expectedId;
    this.type = type;
  }

  @Override protected boolean matchesSafely(final TextView textView) {
    return drawableMatches(textView, type.getDrawable(textView), expectedId);
  }

  @Override public void describeTo(final Description description) {
    if (expectedId == NO_DRAWABLE) {
      description.appendText("with no ")
          .appendText(type.string)
          .appendText(" drawable");
    } else {
      description.appendText("with ")
          .appendText(type.string)
          .appendText(" drawable from resource id: ")
          .appendValue(expectedId);
    }
  }

  enum Type {
    DRAWABLE_LEFT(INDEX_LEFT, false, "left"),
    DRAWABLE_RELATIVE_LEFT(INDEX_LEFT, true, "relative left"),
    DRAWABLE_TOP(INDEX_TOP, false, "top"),
    DRAWABLE_RELATIVE_TOP(INDEX_TOP, true, "relative top"),
    DRAWABLE_RIGHT(INDEX_RIGHT, false, "right"),