Home | History | Annotate | Download | only in widget
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.support.v4.widget;
     18 
     19 import static android.support.annotation.RestrictTo.Scope.LIBRARY_GROUP;
     20 
     21 import android.content.res.ColorStateList;
     22 import android.graphics.PorterDuff;
     23 import android.support.annotation.Nullable;
     24 import android.support.annotation.RestrictTo;
     25 
     26 /**
     27  * Interface which allows an {@link android.widget.ImageView} to receive image tinting calls
     28  * from {@link ImageViewCompat} when running on API v20 devices or lower.
     29  *
     30  * @hide Internal use only
     31  */
     32 @RestrictTo(LIBRARY_GROUP)
     33 public interface TintableImageSourceView {
     34 
     35     /**
     36      * Applies a tint to the image drawable. Does not modify the current tint
     37      * mode, which is {@link PorterDuff.Mode#SRC_IN} by default.
     38      * <p>
     39      * Subsequent calls to the source's image will automatically
     40      * mutate the drawable and apply the specified tint and tint mode.
     41      *
     42      * @param tint the tint to apply, may be {@code null} to clear tint
     43      *
     44      * @see #getSupportImageTintList()
     45      */
     46     void setSupportImageTintList(@Nullable ColorStateList tint);
     47 
     48     /**
     49      * Return the tint applied to the image drawable, if specified.
     50      *
     51      * @return the tint applied to the image drawable
     52      */
     53     @Nullable
     54     ColorStateList getSupportImageTintList();
     55 
     56     /**
     57      * Specifies the blending mode used to apply the tint specified by
     58      * {@link #setSupportImageTintList(ColorStateList)}} to the image
     59      * drawable. The default mode is {@link PorterDuff.Mode#SRC_IN}.
     60      *
     61      * @param tintMode the blending mode used to apply the tint, may be
     62      *                 {@code null} to clear tint
     63      * @see #getSupportImageTintMode()
     64      */
     65     void setSupportImageTintMode(@Nullable PorterDuff.Mode tintMode);
     66 
     67     /**
     68      * Return the blending mode used to apply the tint to the image
     69      * drawable, if specified.
     70      *
     71      * @return the blending mode used to apply the tint to the image drawable
     72      */
     73     @Nullable
     74     PorterDuff.Mode getSupportImageTintMode();
     75 }
     76