OSDN Git Service

5263e13c6545af6099a5e29f04f80bc65b9324a8
[android-x86/packages-apps-Eleven.git] / src / com / cyanogenmod / eleven / widgets / LayoutSuppressingImageView.java
1 /*
2  * Copyright (C) 2012 Android Open Source Project Licensed under the Apache
3  * License, Version 2.0 (the "License"); you may not use this file except in
4  * compliance with the License. You may obtain a copy of the License at
5  * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
6  * or agreed to in writing, software distributed under the License is
7  * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the specific language
9  * governing permissions and limitations under the License.
10  */
11
12 package com.cyanogenmod.eleven.widgets;
13
14 import android.content.Context;
15 import android.util.AttributeSet;
16 import android.widget.ImageView;
17
18 /**
19  * A custom {@link ImageView} that improves the performance by not passing
20  * requestLayout() to its parent, taking advantage of knowing that image size
21  * won't change once set.
22  */
23 public class LayoutSuppressingImageView extends ImageView {
24
25     /**
26      * @param context The {@link Context} to use
27      * @param attrs The attributes of the XML tag that is inflating the view
28      */
29     public LayoutSuppressingImageView(final Context context, final AttributeSet attrs) {
30         super(context, attrs);
31
32     }
33
34     /**
35      * {@inheritDoc}
36      */
37     @Override
38     public void requestLayout() {
39         forceLayout();
40     }
41
42 }