15d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey/*
25d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * Copyright (C) 2011 The Android Open Source Project
35d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey *
45d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * Licensed under the Apache License, Version 2.0 (the "License");
55d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * you may not use this file except in compliance with the License.
65d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * You may obtain a copy of the License at
75d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey *
85d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey *      http://www.apache.org/licenses/LICENSE-2.0
95d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey *
105d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * Unless required by applicable law or agreed to in writing, software
115d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * distributed under the License is distributed on an "AS IS" BASIS,
125d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * See the License for the specific language governing permissions and
145d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * limitations under the License.
155d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey */
165d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey
175d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkeypackage com.android.settings.drawable;
185d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey
195d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkeyimport android.graphics.drawable.Drawable;
205d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey
215d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey/**
225d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * Wrapper around another {@link Drawable} that insets requested bounds by a
235d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey * specific amount.
245d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey */
255d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkeypublic class InsetBoundsDrawable extends DrawableWrapper {
265d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey    private final int mInsetBoundsSides;
275d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey
285d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey    public InsetBoundsDrawable(Drawable drawable, int insetBoundsSides) {
295d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey        super(drawable);
305d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey        mInsetBoundsSides = insetBoundsSides;
315d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey    }
325d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey
335d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey    @Override
345d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey    public void setBounds(int left, int top, int right, int bottom) {
355d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey        super.setBounds(left + mInsetBoundsSides, top, right - mInsetBoundsSides, bottom);
365d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey    }
375d70679c02a57416eac46581d7242e2382e4b973Jeff Sharkey}
38