Skip to content

Instantly share code, notes, and snippets.

View cdmunoz's full-sized avatar

Carlos Daniel cdmunoz

View GitHub Profile
@cdmunoz
cdmunoz / TextViewColorMatcher.java
Created October 13, 2018 23:19
TextViewColorMatcher: Verifies that a TextView has an specific color
public static Matcher<View> textViewTextColorMatcher(final int matcherColor) {
return new BoundedMatcher<View, TextView>(TextView.class) {
@Override
public void describeTo(Description description) {
description.appendText("with text color: " + matcherColor);
}
@Override
protected boolean matchesSafely(TextView textView) {
return matcherColor == textView.getCurrentTextColor();
}
@cdmunoz
cdmunoz / EditTextWithItemHint.java
Created October 13, 2018 23:18
EditTextWithItemHint: Verifies if a text matches the text of an EditText hint
public static Matcher<View> editTextwithItemHint(final String matcherText) {
return new BoundedMatcher<View, EditText>(EditText.class) {
@Override
public void describeTo(Description description) {
description.appendText("with item hint: " + matcherText);
}
@Override
protected boolean matchesSafely(EditText editTextField) {
@cdmunoz
cdmunoz / WithSeekBarProgress.java
Created October 13, 2018 23:17
WithSeekBarProgress: Matcher to check the value/progress of a SeekBar
public static Matcher<View> withSeekbarProgress(final int expectedProgress) {
return new BoundedMatcher<View, AppCompatSeekBar>(AppCompatSeekBar.class) {
@Override
public void describeTo(Description description) {
description.appendText("expected: ");
description.appendText("" + expectedProgress);
}
@Override
public boolean matchesSafely(AppCompatSeekBar seekBar) {
return seekBar.getProgress() == expectedProgress;
@cdmunoz
cdmunoz / TextInputLayoutWithItemHint.java
Created October 13, 2018 23:16
TextInputLayoutWithItemHint: Verifies if a text matches the text of a TextInputLayout hint
public static Matcher<View> textInputLayoutwithItemHint(final String matcherText) {
return new BoundedMatcher<View, TextInputLayout>(TextInputLayout.class) {
@Override
public void describeTo(Description description) {
description.appendText("with item hint: " + matcherText);
}
@Override
protected boolean matchesSafely(TextInputLayout editTextField) {
@cdmunoz
cdmunoz / RecyclerViewAtPositionOnView.java
Created October 13, 2018 23:15
RecyclerViewAtPositionOnView: Goes to an specific position in a RecyclerView, then checks if that item has specific information (i.e an specific text in the holder)
public static Matcher<View> recyclerViewAtPositionOnView(final int position, final Matcher<View> itemMatcher, @NonNull final int targetViewId) {
return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
@Override
public void describeTo(Description description) {
description.appendText("has view id " + itemMatcher + " at position " + position);
}
@Override
public boolean matchesSafely(final RecyclerView recyclerView) {
RecyclerView.ViewHolder viewHolder = recyclerView.findViewHolderForAdapterPosition(position);
@cdmunoz
cdmunoz / RecyclerViewSizeMatcher.java
Created October 13, 2018 23:14
RecyclerViewSizeMatcher: Custom Espresso Matcher to check the size of a RecyclerView
public static Matcher<View> recyclerViewSizeMatcher(final int matcherSize) {
return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
@Override
public void describeTo(Description description) {
description.appendText("with list size: " + matcherSize);
}
@Override
protected boolean matchesSafely(RecyclerView recyclerView) {
return matcherSize == recyclerView.getAdapter().getItemCount();
@cdmunoz
cdmunoz / WithListSize.java
Created October 13, 2018 23:13
WhitListSize: Custom Espresso Matcher which checks if a ListView has an specific size
public static Matcher<View> withListSize (final int size) {
return new TypeSafeMatcher<View>() {
@Override public boolean matchesSafely (final View view) {
return ((ListView) view).getCount () == size;
}
@Override public void describeTo (final Description description) {
description.appendText ("ListView should have " + size + " items");
}
};
}
@cdmunoz
cdmunoz / WithListSize.kt
Created October 13, 2018 23:11
WhitListSize: Custom Espresso Matcher which checks if a ListView has an specific size
fun withListSize(size: Int): Matcher<View> {
return object : TypeSafeMatcher<View>() {
public override fun matchesSafely(view: View): Boolean {
return (view as ListView).count == size
}
override fun describeTo(description: Description) {
description.appendText("ListView should have $size items")
}
}
}
package com.earlywarning.zelle.common.widget;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import butterknife.BindDrawable;
import butterknife.ButterKnife;
import com.earlywarning.zelle.R;
package com.earlywarning.zelle.get_started;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.InputType;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;