1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/widget/TabThumbnailWrapper.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 1.4 +package org.mozilla.gecko.widget; 1.5 + 1.6 +import android.content.Context; 1.7 +import android.util.AttributeSet; 1.8 +import android.widget.FrameLayout; 1.9 +import org.mozilla.gecko.R; 1.10 + 1.11 + 1.12 +public class TabThumbnailWrapper extends FrameLayout { 1.13 + private boolean mRecording = false; 1.14 + private static final int[] STATE_RECORDING = { R.attr.state_recording }; 1.15 + 1.16 + public TabThumbnailWrapper(Context context, AttributeSet attrs, int defStyle) { 1.17 + super(context, attrs, defStyle); 1.18 + } 1.19 + 1.20 + public TabThumbnailWrapper(Context context, AttributeSet attrs) { 1.21 + super(context, attrs); 1.22 + } 1.23 + 1.24 + public TabThumbnailWrapper(Context context) { 1.25 + super(context); 1.26 + } 1.27 + 1.28 + @Override 1.29 + public int[] onCreateDrawableState(int extraSpace) { 1.30 + final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); 1.31 + 1.32 + if (mRecording) { 1.33 + mergeDrawableStates(drawableState, STATE_RECORDING); 1.34 + } 1.35 + return drawableState; 1.36 + } 1.37 + 1.38 + public void setRecording(boolean recording) { 1.39 + if (mRecording != recording) { 1.40 + mRecording = recording; 1.41 + refreshDrawableState(); 1.42 + } 1.43 + } 1.44 + 1.45 +}