summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ActionMenuButton.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/ActionMenuButton.java')
-rw-r--r--src/com/android/camera/ActionMenuButton.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/camera/ActionMenuButton.java b/src/com/android/camera/ActionMenuButton.java
index 65e1f0e..d6d355a 100644
--- a/src/com/android/camera/ActionMenuButton.java
+++ b/src/com/android/camera/ActionMenuButton.java
@@ -34,8 +34,13 @@ public class ActionMenuButton extends TextView {
private static final float PADDING_H = 5.0f;
private static final float PADDING_V = 1.0f;
+ private static final int[] RESTRICTED_STATE_SET = {
+ R.attr.state_restricted
+ };
+
private final RectF mRect = new RectF();
private Paint mPaint;
+ private boolean mRestricted = false;
public ActionMenuButton(Context context) {
super(context);
@@ -59,6 +64,26 @@ public class ActionMenuButton extends TextView {
mPaint.setColor(getContext().getResources().getColor(R.color.bubble_dark_background));
}
+ public void setRestricted(boolean restricted) {
+ if (restricted != mRestricted) {
+ mRestricted = restricted;
+ refreshDrawableState();
+ }
+ }
+
+ public boolean isRestricted() {
+ return mRestricted;
+ }
+
+ @Override
+ protected int[] onCreateDrawableState(int extraSpace) {
+ int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
+ if (isRestricted()) {
+ mergeDrawableStates(drawableState, RESTRICTED_STATE_SET);
+ }
+ return drawableState;
+ }
+
@Override
protected void drawableStateChanged() {
invalidate();