Joe Onorato | 503007d | 2010-04-16 09:20:55 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 | |
Joe Onorato | fd52b18 | 2010-11-10 18:00:52 -0800 | [diff] [blame] | 17 | package com.android.systemui.statusbar.policy; |
Joe Onorato | 503007d | 2010-04-16 09:20:55 -0700 | [diff] [blame] | 18 | |
| 19 | import android.graphics.drawable.Drawable; |
| 20 | import android.graphics.Canvas; |
| 21 | import android.graphics.ColorFilter; |
| 22 | import android.graphics.Rect; |
| 23 | import android.util.Slog; |
| 24 | |
Joe Onorato | fd52b18 | 2010-11-10 18:00:52 -0800 | [diff] [blame] | 25 | public class FixedSizeDrawable extends Drawable { |
Joe Onorato | 503007d | 2010-04-16 09:20:55 -0700 | [diff] [blame] | 26 | Drawable mDrawable; |
| 27 | int mLeft; |
| 28 | int mTop; |
| 29 | int mRight; |
| 30 | int mBottom; |
| 31 | |
Joe Onorato | fd52b18 | 2010-11-10 18:00:52 -0800 | [diff] [blame] | 32 | public FixedSizeDrawable(Drawable that) { |
Joe Onorato | 503007d | 2010-04-16 09:20:55 -0700 | [diff] [blame] | 33 | mDrawable = that; |
| 34 | } |
| 35 | |
| 36 | public void setFixedBounds(int l, int t, int r, int b) { |
| 37 | mLeft = l; |
| 38 | mTop = t; |
| 39 | mRight = r; |
| 40 | mBottom = b; |
| 41 | } |
| 42 | |
| 43 | public void setBounds(Rect bounds) { |
| 44 | mDrawable.setBounds(mLeft, mTop, mRight, mBottom); |
| 45 | } |
| 46 | |
| 47 | public void setBounds(int l, int t, int r, int b) { |
| 48 | mDrawable.setBounds(mLeft, mTop, mRight, mBottom); |
| 49 | } |
| 50 | |
| 51 | public void draw(Canvas canvas) { |
| 52 | mDrawable.draw(canvas); |
| 53 | } |
| 54 | |
| 55 | public int getOpacity() { |
| 56 | return mDrawable.getOpacity(); |
| 57 | } |
| 58 | |
| 59 | public void setAlpha(int alpha) { |
| 60 | mDrawable.setAlpha(alpha); |
| 61 | } |
| 62 | |
| 63 | public void setColorFilter(ColorFilter cf) { |
| 64 | mDrawable.setColorFilter(cf); |
| 65 | } |
| 66 | } |