Example usage for android.support.v4.view TintableBackgroundView setSupportBackgroundTintMode

List of usage examples for android.support.v4.view TintableBackgroundView setSupportBackgroundTintMode

Introduction

In this page you can find the example usage for android.support.v4.view TintableBackgroundView setSupportBackgroundTintMode.

Prototype

void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode);

Source Link

Document

Specifies the blending mode used to apply the tint specified by #setSupportBackgroundTintList(ColorStateList) } to the background drawable.

Usage

From source file:android.support.v7.testutils.AppCompatTintableViewActions.java

/**
 * Sets the passed mode as the background tint mode on a <code>View</code> that
 * implements the <code>TintableBackgroundView</code> interface.
 *///from  w  w  w .j ava2s  . c  o m
public static ViewAction setBackgroundTintMode(final PorterDuff.Mode tintMode) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return allOf(isDisplayed(), TestUtilsMatchers.isTintableBackgroundView());
        }

        @Override
        public String getDescription() {
            return "set background tint mode";
        }

        @Override
        public void perform(UiController uiController, View view) {
            uiController.loopMainThreadUntilIdle();

            TintableBackgroundView tintableBackgroundView = (TintableBackgroundView) view;
            tintableBackgroundView.setSupportBackgroundTintMode(tintMode);

            uiController.loopMainThreadUntilIdle();
        }
    };
}