/** @brief Determine layout size of element. */ @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int height, newHeight; int width, newWidth; int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec); int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec); // take height/width from the parameter ... height = MeasureSpec.getSize(heightMeasureSpec); width = MeasureSpec.getSize(widthMeasureSpec); newWidth = PDEBuildingUnits.roundUpToScreenCoordinates(getElementWidth()); if (newWidth < width) { width = newWidth; } if (widthSpecMode == MeasureSpec.UNSPECIFIED && width == 0) { width = newWidth; } newHeight = PDEBuildingUnits.roundUpToScreenCoordinates(getElementHeight()); if (newHeight < height) { height = newHeight; } if (heightSpecMode == MeasureSpec.UNSPECIFIED && height == 0) { height = newHeight; } if (mVideo != null) { mInternalCalculateAspectRatioBounds.set(0, 0, width, height); mInternalCalculateAspectRatioBounds = elementCalculateAspectRatioBounds(mInternalCalculateAspectRatioBounds); width = mInternalCalculateAspectRatioBounds.width(); height = mInternalCalculateAspectRatioBounds.height(); } // return the values setMeasuredDimension( resolveSize(width, widthMeasureSpec), resolveSize(height, heightMeasureSpec)); }
/** * @brief init shadow drawable. * <p>Creates and delivers the outer shadow drawable. * @return The outer shadow drawable. */ public PDEDrawableShapedShadow createElementShadow() { // already created? if (mElementShadowDrawable != null) return mElementShadowDrawable; // init shadow drawable mElementShadowDrawable = new PDEDrawableShapedShadow(); mElementShadowDrawable.setElementShapeOpacity(0.25f); mElementShadowDrawable.setElementBlurRadius(5.0f); setNeededPadding(PDEBuildingUnits.oneHalfBU()); updateElementShadowDrawable(new Point(getBounds().width(), getBounds().height())); // return return mElementShadowDrawable; }