import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.service.quicksettings.Tile;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
public void init(OnClickListener click, OnClickListener secondaryClick,
OnLongClickListener longClick) {
- setClickable(true);
setOnClickListener(click);
setOnLongClickListener(longClick);
}
}
protected void handleStateChanged(QSTile.State state) {
+ setClickable(state.state != Tile.STATE_UNAVAILABLE);
mIcon.setIcon(state);
setContentDescription(state.contentDescription);
mAccessibilityClass = state.expandedAccessibilityClassName;
}
@Override
+ public void setClickable(boolean clickable) {
+ super.setClickable(clickable);
+ setBackground(clickable ? mRipple : null);
+ }
+
+ @Override
public int getDetailY() {
return getTop() + getHeight() / 2;
}
state.expandedAccessibilityClassName = Switch.class.getName();
state.value = mDataController.isMobileDataSupported()
&& mDataController.isMobileDataEnabled();
- state.state = state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
+ state.state = cb.airplaneModeEnabled ? Tile.STATE_UNAVAILABLE
+ : state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
}
@Override