use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartBarView method recreateButtonLayout.
void recreateButtonLayout(ArrayList<ButtonConfig> buttonConfigs, boolean landscape, boolean updateCurrentButtons) {
int extraKeyWidth = getContext().getResources().getDimensionPixelSize(R.dimen.navigation_extra_key_width);
int extraKeyHeight = getContext().getResources().getDimensionPixelSize(R.dimen.navigation_extra_key_height);
LinearLayout navButtonLayout = (LinearLayout) (landscape ? mRot90.findViewWithTag(Res.Common.NAV_BUTTONS) : mRot0.findViewWithTag(Res.Common.NAV_BUTTONS));
navButtonLayout.removeAllViews();
if (buttonConfigs == null) {
buttonConfigs = Config.getConfig(getContext(), ActionConstants.getDefaults(ActionConstants.SMARTBAR));
}
// left context frame layout
FrameLayout leftContext = generateContextKeyLayout(landscape, Res.Softkey.CONTEXT_VIEW_LEFT, extraKeyWidth, extraKeyHeight);
SmartBarHelper.addViewToRoot(navButtonLayout, leftContext, landscape);
// tablets get a spacer here
if (BaseNavigationBar.sIsTablet) {
SmartBarHelper.addViewToRoot(navButtonLayout, SmartBarHelper.makeSeparator(getContext()), landscape);
}
// softkey buttons
ButtonConfig buttonConfig;
int dimen = SmartBarHelper.getButtonSize(getContext(), buttonConfigs.size(), landscape);
for (int j = 0; j < buttonConfigs.size(); j++) {
buttonConfig = buttonConfigs.get(j);
OpaLayout v = SmartBarHelper.generatePrimaryKey(getContext(), this, landscape, buttonConfig);
SmartBarHelper.updateButtonSize(v, dimen, landscape);
SmartButtonView sb = v.getButton();
SmartBarHelper.updateButtonSize(sb, dimen, landscape);
SmartBarHelper.addViewToRoot(navButtonLayout, v, landscape);
// only add once for master sequence holder
if (updateCurrentButtons) {
mCurrentSequence.add((String) v.getButton().getTag());
}
// tablets get a spacer before first and after last
if (j != buttonConfigs.size() - 1 && !BaseNavigationBar.sIsTablet) {
// adding spacers between buttons on phones
SmartBarHelper.addViewToRoot(navButtonLayout, SmartBarHelper.makeSeparator(getContext()), landscape);
}
if (j == buttonConfigs.size() - 1 && BaseNavigationBar.sIsTablet) {
// adding spacers after last button on tablets
SmartBarHelper.addViewToRoot(navButtonLayout, SmartBarHelper.makeSeparator(getContext()), landscape);
}
}
// right context frame layout
FrameLayout rightContext = generateContextKeyLayout(landscape, Res.Softkey.CONTEXT_VIEW_RIGHT, extraKeyWidth, extraKeyHeight);
SmartBarHelper.addViewToRoot(navButtonLayout, rightContext, landscape);
}
use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartBarHelper method generatePrimaryKey.
static OpaLayout generatePrimaryKey(Context ctx, SmartBarView host, boolean landscape, ButtonConfig config) {
OpaLayout opa = (OpaLayout) View.inflate(ctx, R.layout.opa_smartbutton, null);
SmartButtonView v = opa.getButton();
v.setHost(host);
v.setButtonConfig(config);
int width = ctx.getResources().getDimensionPixelSize(R.dimen.navigation_key_width);
int height = ctx.getResources().getDimensionPixelSize(R.dimen.navigation_key_height);
v.loadRipple();
updateButtonScalingAndPadding(opa, landscape);
host.setButtonDrawable(v);
if (BaseNavigationBar.sIsTablet) {
v.setLayoutParams(new FrameLayout.LayoutParams(width, LayoutParams.MATCH_PARENT));
opa.setLayoutParams(new LinearLayout.LayoutParams(width, LayoutParams.MATCH_PARENT));
} else {
if (landscape) {
v.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, height));
opa.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, height));
} else {
v.setLayoutParams(new FrameLayout.LayoutParams(width, LayoutParams.MATCH_PARENT));
opa.setLayoutParams(new LinearLayout.LayoutParams(width, LayoutParams.MATCH_PARENT));
}
}
return opa;
}
use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartButtonView method setPixelEnabled.
public void setPixelEnabled(boolean enabled, boolean homeOnly, boolean rippleForOthers) {
if (getParent() != null && getParent() instanceof OpaLayout) {
OpaLayout opa = (OpaLayout) getParent();
opa.setOpaEnabled(enabled);
if (enabled) {
boolean isHomeButton = TextUtils.equals(mConfig.getTag(), Res.Softkey.BUTTON_HOME);
if (!rippleForOthers) {
opa.setOpaVisibilityHome(homeOnly, isHomeButton);
} else {
if (isHomeButton) {
opa.setOpaVisibilityHome(homeOnly, isHomeButton);
} else {
opa.setOpaEnabled(!enabled);
setRippleEnabled(enabled);
}
}
}
}
}
use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartButtonView method setEditMode.
public void setEditMode(boolean editMode) {
mInEditMode = editMode;
if (editMode && mSpring != null) {
if (getScaleX() != 1f || getScaleY() != 1f) {
mSpring.setCurrentValue(0f);
}
}
if (getParent() != null && getParent() instanceof OpaLayout) {
OpaLayout opa = (OpaLayout) getParent();
opa.setEditMode(editMode);
}
}
use of com.android.systemui.navigation.OpaLayout in project android_packages_apps_DUI by DirtyUnicorns.
the class SmartBarEditor method prepareToShowPopup.
private void prepareToShowPopup(View editView) {
mHost.removeCallbacks(mHidePopupContainer);
ViewGroup parent = (ViewGroup) editView.getParent();
mEditContainer.setVisibility(View.VISIBLE);
OpaLayout opa = (OpaLayout) editView;
mHidden.setTag(opa.getButton().getTag());
mHidden.getLayoutParams().width = editView.getWidth();
mHidden.getLayoutParams().height = editView.getHeight();
mHidden.setLayoutParams(mHidden.getLayoutParams());
mHidden.setX(mOriginPoint.x - parent.getLeft());
mHidden.setY(mOriginPoint.y - parent.getTop());
}
Aggregations