• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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.view;
18 
19 import android.content.res.ColorStateList;
20 import android.graphics.PorterDuff;
21 import android.support.annotation.Nullable;
22 
23 /**
24  * Interface which allows a {@link android.view.View} to receive background tinting calls from
25  * {@link ViewCompat} when running on API v20 devices or lower.
26  */
27 public interface TintableBackgroundView {
28 
29     /**
30      * Applies a tint to the background drawable. Does not modify the current tint
31      * mode, which is {@link PorterDuff.Mode#SRC_IN} by default.
32      * <p>
33      * Subsequent calls to {@code View.setBackground(Drawable)} will automatically
34      * mutate the drawable and apply the specified tint and tint mode.
35      *
36      * @param tint the tint to apply, may be {@code null} to clear tint
37      *
38      * @see #getSupportBackgroundTintList()
39      */
setSupportBackgroundTintList(@ullable ColorStateList tint)40     void setSupportBackgroundTintList(@Nullable ColorStateList tint);
41 
42     /**
43      * Return the tint applied to the background drawable, if specified.
44      *
45      * @return the tint applied to the background drawable
46      */
47     @Nullable
getSupportBackgroundTintList()48     ColorStateList getSupportBackgroundTintList();
49 
50     /**
51      * Specifies the blending mode used to apply the tint specified by
52      * {@link #setSupportBackgroundTintList(ColorStateList)}} to the background
53      * drawable. The default mode is {@link PorterDuff.Mode#SRC_IN}.
54      *
55      * @param tintMode the blending mode used to apply the tint, may be
56      *                 {@code null} to clear tint
57      * @see #getSupportBackgroundTintMode()
58      */
setSupportBackgroundTintMode(@ullable PorterDuff.Mode tintMode)59     void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode tintMode);
60 
61     /**
62      * Return the blending mode used to apply the tint to the background
63      * drawable, if specified.
64      *
65      * @return the blending mode used to apply the tint to the background
66      *         drawable
67      */
68     @Nullable
getSupportBackgroundTintMode()69     PorterDuff.Mode getSupportBackgroundTintMode();
70 }
71