| |
1 package org.mozilla.gecko.widget; |
| |
2 |
| |
3 import android.content.Context; |
| |
4 import android.util.AttributeSet; |
| |
5 import android.widget.FrameLayout; |
| |
6 import org.mozilla.gecko.R; |
| |
7 |
| |
8 |
| |
9 public class TabThumbnailWrapper extends FrameLayout { |
| |
10 private boolean mRecording = false; |
| |
11 private static final int[] STATE_RECORDING = { R.attr.state_recording }; |
| |
12 |
| |
13 public TabThumbnailWrapper(Context context, AttributeSet attrs, int defStyle) { |
| |
14 super(context, attrs, defStyle); |
| |
15 } |
| |
16 |
| |
17 public TabThumbnailWrapper(Context context, AttributeSet attrs) { |
| |
18 super(context, attrs); |
| |
19 } |
| |
20 |
| |
21 public TabThumbnailWrapper(Context context) { |
| |
22 super(context); |
| |
23 } |
| |
24 |
| |
25 @Override |
| |
26 public int[] onCreateDrawableState(int extraSpace) { |
| |
27 final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); |
| |
28 |
| |
29 if (mRecording) { |
| |
30 mergeDrawableStates(drawableState, STATE_RECORDING); |
| |
31 } |
| |
32 return drawableState; |
| |
33 } |
| |
34 |
| |
35 public void setRecording(boolean recording) { |
| |
36 if (mRecording != recording) { |
| |
37 mRecording = recording; |
| |
38 refreshDrawableState(); |
| |
39 } |
| |
40 } |
| |
41 |
| |
42 } |