Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | package org.mozilla.gecko.widget; |
michael@0 | 2 | |
michael@0 | 3 | import android.content.Context; |
michael@0 | 4 | import android.util.AttributeSet; |
michael@0 | 5 | import android.widget.FrameLayout; |
michael@0 | 6 | import org.mozilla.gecko.R; |
michael@0 | 7 | |
michael@0 | 8 | |
michael@0 | 9 | public class TabThumbnailWrapper extends FrameLayout { |
michael@0 | 10 | private boolean mRecording = false; |
michael@0 | 11 | private static final int[] STATE_RECORDING = { R.attr.state_recording }; |
michael@0 | 12 | |
michael@0 | 13 | public TabThumbnailWrapper(Context context, AttributeSet attrs, int defStyle) { |
michael@0 | 14 | super(context, attrs, defStyle); |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | public TabThumbnailWrapper(Context context, AttributeSet attrs) { |
michael@0 | 18 | super(context, attrs); |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | public TabThumbnailWrapper(Context context) { |
michael@0 | 22 | super(context); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | @Override |
michael@0 | 26 | public int[] onCreateDrawableState(int extraSpace) { |
michael@0 | 27 | final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); |
michael@0 | 28 | |
michael@0 | 29 | if (mRecording) { |
michael@0 | 30 | mergeDrawableStates(drawableState, STATE_RECORDING); |
michael@0 | 31 | } |
michael@0 | 32 | return drawableState; |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | public void setRecording(boolean recording) { |
michael@0 | 36 | if (mRecording != recording) { |
michael@0 | 37 | mRecording = recording; |
michael@0 | 38 | refreshDrawableState(); |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | } |