summaryrefslogtreecommitdiffstats
path: root/mobile/android/base/java/org/mozilla/gecko/widget/TabThumbnailWrapper.java
blob: 848e2f6ed1f663a4f78cc3b3c7ce7820ae7a67de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.mozilla.gecko.widget;

import android.content.Context;
import android.util.AttributeSet;
import org.mozilla.gecko.R;
import org.mozilla.gecko.widget.themed.ThemedRelativeLayout;


public class TabThumbnailWrapper extends ThemedRelativeLayout {
    private boolean mRecording;
    private static final int[] STATE_RECORDING = { R.attr.state_recording };

    public TabThumbnailWrapper(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public TabThumbnailWrapper(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public int[] onCreateDrawableState(int extraSpace) {
        final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);

        if (mRecording) {
            mergeDrawableStates(drawableState, STATE_RECORDING);
        }
        return drawableState;
    }

    public void setRecording(boolean recording) {
        if (mRecording != recording) {
            mRecording = recording;
            refreshDrawableState();
        }
    }

}