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 com.android.contacts.drawer; 18 19 import android.graphics.drawable.ColorDrawable; 20 21 /** 22 * Create a simple scrim that covers just the status bar area when necessary. 23 * Copied from com.google.android.gms.people.accountswitcherview.ScrimDrawable; 24 */ 25 public class ScrimDrawable extends ColorDrawable { 26 public static final int DEFAULT_COLOR = 0x33000000; 27 28 /** 29 * Default constructor. Uses default color. 30 */ ScrimDrawable()31 public ScrimDrawable() { 32 this(DEFAULT_COLOR); 33 } 34 35 /** 36 * Set a color if necessary. 37 * 38 * @param color 39 */ ScrimDrawable(int color)40 public ScrimDrawable(int color) { 41 super(color); 42 } 43 44 private int mIntrinsicHeight; 45 46 @Override getIntrinsicHeight()47 public int getIntrinsicHeight() { 48 return mIntrinsicHeight; 49 } 50 setIntrinsicHeight(int intrinsicHeight)51 public void setIntrinsicHeight(int intrinsicHeight) { 52 mIntrinsicHeight = intrinsicHeight; 53 } 54 }