Search in sources :

Example 1 with CountingIdlingResource

use of android.support.test.espresso.contrib.CountingIdlingResource in project android-topeka by googlesamples.

the class QuizActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    mCountingIdlingResource = new CountingIdlingResource("Quiz");
    String categoryId = getIntent().getStringExtra(Category.TAG);
    mInterpolator = new FastOutSlowInInterpolator();
    if (null != savedInstanceState) {
        mSavedStateIsPlaying = savedInstanceState.getBoolean(STATE_IS_PLAYING);
    }
    super.onCreate(savedInstanceState);
    populate(categoryId);
    int categoryNameTextSize = getResources().getDimensionPixelSize(R.dimen.category_item_text_size);
    int paddingStart = getResources().getDimensionPixelSize(R.dimen.spacing_double);
    final int startDelay = getResources().getInteger(R.integer.toolbar_transition_duration);
    ActivityCompat.setEnterSharedElementCallback(this, new TextSharedElementCallback(categoryNameTextSize, paddingStart) {

        @Override
        public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
            super.onSharedElementStart(sharedElementNames, sharedElements, sharedElementSnapshots);
            mToolbarBack.setScaleX(0f);
            mToolbarBack.setScaleY(0f);
        }

        @Override
        public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
            super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots);
            // Make sure to perform this animation after the transition has ended.
            ViewCompat.animate(mToolbarBack).setStartDelay(startDelay).scaleX(1f).scaleY(1f).alpha(1f);
        }
    });
}
Also used : CountingIdlingResource(android.support.test.espresso.contrib.CountingIdlingResource) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator) TextSharedElementCallback(com.google.samples.apps.topeka.widget.TextSharedElementCallback) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) SuppressLint(android.annotation.SuppressLint)

Example 2 with CountingIdlingResource

use of android.support.test.espresso.contrib.CountingIdlingResource in project RxBinding by JakeWharton.

the class RxSlidingPaneLayoutTest method setUp.

@Before
public void setUp() {
    RxSlidingPaneLayoutTestActivity activity = activityRule.getActivity();
    view = activity.slidingPaneLayout;
    idler = new CountingIdlingResource("counting idler");
    Espresso.registerIdlingResources(idler);
}
Also used : CountingIdlingResource(android.support.test.espresso.contrib.CountingIdlingResource) Before(org.junit.Before)

Aggregations

CountingIdlingResource (android.support.test.espresso.contrib.CountingIdlingResource)2 SuppressLint (android.annotation.SuppressLint)1 FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 TextSharedElementCallback (com.google.samples.apps.topeka.widget.TextSharedElementCallback)1 Before (org.junit.Before)1