This source file includes following definitions.
- setChecked
- setPressed
- onCreateDrawableState
package org.chromium.chrome.browser.appmenu;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
class AppMenuItemIcon extends ImageView {
private static final int[] CHECKED_STATE_SET = new int[] {android.R.attr.state_checked};
private boolean mCheckedState;
public AppMenuItemIcon(Context context, AttributeSet attrs) {
super(context, attrs);
}
protected void setChecked(boolean state) {
if (state == mCheckedState) return;
mCheckedState = state;
refreshDrawableState();
}
@Override
public void setPressed(boolean state) {
return;
}
@Override
public int[] onCreateDrawableState(int extraSpace) {
final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
if (mCheckedState) {
mergeDrawableStates(drawableState, CHECKED_STATE_SET);
}
return drawableState;
}