use of com.android.systemui.statusbar.phone.NavbarEditor.ButtonInfo in project android_frameworks_base by ParanoidAndroid.
the class KeyButtonView method setInfo.
public void setInfo(String itemKey, boolean isVertical) {
ButtonInfo item = NavbarEditor.buttonMap.get(itemKey);
setTag(itemKey);
final Resources res = getResources();
setContentDescription(res.getString(item.contentDescription));
mCode = item.keyCode;
boolean isSmallButton = ArrayUtils.contains(NavbarEditor.smallButtonIds, getId());
Drawable keyD;
if (isSmallButton) {
keyD = res.getDrawable(item.sideResource);
} else if (!isVertical) {
keyD = res.getDrawable(item.portResource);
} else {
keyD = res.getDrawable(item.landResource);
}
//Reason for setImageDrawable vs setImageResource is because setImageResource calls relayout() w/o
//any checks. setImageDrawable performs size checks and only calls relayout if necessary. We rely on this
//because otherwise the setX/setY attributes which are post layout cause it to mess up the layout.
setImageDrawable(keyD);
if (itemKey.equals(NavbarEditor.NAVBAR_EMPTY)) {
if (isSmallButton) {
setVisibility(NavigationBarView.getEditMode() ? View.VISIBLE : View.INVISIBLE);
} else {
setVisibility(NavigationBarView.getEditMode() ? View.VISIBLE : View.GONE);
}
} else if (itemKey.equals(NavbarEditor.NAVBAR_CONDITIONAL_MENU)) {
setVisibility(NavigationBarView.getEditMode() ? View.VISIBLE : View.INVISIBLE);
} else if (itemKey.equals(NavbarEditor.NAVBAR_HOME)) {
mSupportsLongpress = false;
}
}
Aggregations