/** @brief Set visual style. */
 public void setContentStyle(int style) {
   PDEConstants.PDEContentStyle contentStyle;
   try {
     contentStyle = PDEConstants.PDEContentStyle.values()[style];
   } catch (Exception e) {
     contentStyle = PDEConstants.PDEContentStyle.PDEContentStyleFlat;
   }
   mVideo.setElementContentStyle(contentStyle);
 }
  /** @brief Initialize. */
  protected void init(Context context, AttributeSet attrs) {
    mVideo = new PDEDrawableVideoMetaphor(null, "");
    mVideo.setElementMiddleAligned(true);

    mInternalCalculateAspectRatioBounds = new Rect(0, 0, 0, 0);

    PDEUtils.setViewBackgroundDrawable(this, mVideo);

    setAttributes(context, attrs);
  }
  /**
   * @param bounds Available space
   * @return Rect with correct aspect ratio, fitting in available space
   * @brief Calculate the correct aspect ratio bounds.
   */
  public Rect elementCalculateAspectRatioBounds(Rect bounds) {
    Rect newBounds;
    int horizontalShift, verticalShift;

    if ((float) bounds.width() / (float) bounds.height() > mVideo.getElementAspectRatio()) {
      newBounds = new Rect(bounds.left, bounds.top, 0, bounds.bottom);
      newBounds.right =
          newBounds.left + Math.round(newBounds.height() * mVideo.getElementAspectRatio());

      horizontalShift = (bounds.width() - newBounds.width()) / 2;
      newBounds.left += horizontalShift;
      newBounds.right += horizontalShift;
    } else {
      newBounds = new Rect(bounds.left, bounds.top, bounds.right, 0);
      newBounds.bottom =
          newBounds.top + Math.round(newBounds.width() / mVideo.getElementAspectRatio());

      verticalShift = (bounds.height() - newBounds.height()) / 2;
      newBounds.top += verticalShift;
      newBounds.bottom += verticalShift;
    }

    return newBounds;
  }
 /** @brief Gets element height. */
 public int getElementHeight() {
   if (mVideo != null) return mVideo.getElementHeight();
   return 0;
 }
 /** @brief Gets element width. */
 public int getElementWidth() {
   if (mVideo != null) return mVideo.getElementWidth();
   return 0;
 }
 /** @brief Returns if element has an icon drawable or icon string set. */
 public boolean hasPicture() {
   return mVideo.hasPicture();
 }
 /** @brief Returns the native size of the icon (e.g. from resource image) */
 public Point getNativeSize() {
   return mVideo.getNativeSize();
 }
 /** @brief Get if shadow is activated. */
 @SuppressWarnings("unused")
 public boolean getShadowEnabled() {
   return mVideo.getElementShadowEnabled();
 }
 /** @brief Activate shadow. */
 public void setShadowEnabled(boolean enabled) {
   mVideo.setElementShadowEnabled(enabled);
 }
 /** @brief Get icon drawable. */
 @SuppressWarnings("unused")
 public Drawable getPictureDrawable() {
   return mVideo.getElementScene();
 }
 /** @brief Set if 16/9 format. */
 public void set169Format(boolean f169) {
   mVideo.setElementFormat169(f169);
   requestLayout();
   invalidate();
 }
 /** @brief Set time string. */
 public void setTimeString(String timeString) {
   mVideo.setElementTimeString(timeString);
   requestLayout();
   invalidate();
 }
 /** @brief Set picture drawable. */
 public void setPictureString(String path) {
   mVideo.setElementScene(Drawable.createFromPath(path));
   requestLayout();
   invalidate();
 }
 /** @brief Set picture drawable. */
 public void setPictureDrawable(Drawable drawable) {
   mVideo.setElementScene(drawable);
   requestLayout();
   invalidate();
 }
 /** @brief Get visual style. */
 public PDEConstants.PDEContentStyle getStyle() {
   return mVideo.getElementContentStyle();
 }
 /** @brief Set visual style. */
 public void setContentStyle(PDEConstants.PDEContentStyle style) {
   mVideo.setElementContentStyle(style);
 }