Exemplo n.º 1
0
 /** @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);
 }
Exemplo n.º 2
0
  /** @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);
  }
Exemplo n.º 3
0
  /**
   * @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;
  }
Exemplo n.º 4
0
 /** @brief Gets element height. */
 public int getElementHeight() {
   if (mVideo != null) return mVideo.getElementHeight();
   return 0;
 }
Exemplo n.º 5
0
 /** @brief Gets element width. */
 public int getElementWidth() {
   if (mVideo != null) return mVideo.getElementWidth();
   return 0;
 }
Exemplo n.º 6
0
 /** @brief Returns if element has an icon drawable or icon string set. */
 public boolean hasPicture() {
   return mVideo.hasPicture();
 }
Exemplo n.º 7
0
 /** @brief Returns the native size of the icon (e.g. from resource image) */
 public Point getNativeSize() {
   return mVideo.getNativeSize();
 }
Exemplo n.º 8
0
 /** @brief Get if shadow is activated. */
 @SuppressWarnings("unused")
 public boolean getShadowEnabled() {
   return mVideo.getElementShadowEnabled();
 }
Exemplo n.º 9
0
 /** @brief Activate shadow. */
 public void setShadowEnabled(boolean enabled) {
   mVideo.setElementShadowEnabled(enabled);
 }
Exemplo n.º 10
0
 /** @brief Get icon drawable. */
 @SuppressWarnings("unused")
 public Drawable getPictureDrawable() {
   return mVideo.getElementScene();
 }
Exemplo n.º 11
0
 /** @brief Set if 16/9 format. */
 public void set169Format(boolean f169) {
   mVideo.setElementFormat169(f169);
   requestLayout();
   invalidate();
 }
Exemplo n.º 12
0
 /** @brief Set time string. */
 public void setTimeString(String timeString) {
   mVideo.setElementTimeString(timeString);
   requestLayout();
   invalidate();
 }
Exemplo n.º 13
0
 /** @brief Set picture drawable. */
 public void setPictureString(String path) {
   mVideo.setElementScene(Drawable.createFromPath(path));
   requestLayout();
   invalidate();
 }
Exemplo n.º 14
0
 /** @brief Set picture drawable. */
 public void setPictureDrawable(Drawable drawable) {
   mVideo.setElementScene(drawable);
   requestLayout();
   invalidate();
 }
Exemplo n.º 15
0
 /** @brief Get visual style. */
 public PDEConstants.PDEContentStyle getStyle() {
   return mVideo.getElementContentStyle();
 }
Exemplo n.º 16
0
 /** @brief Set visual style. */
 public void setContentStyle(PDEConstants.PDEContentStyle style) {
   mVideo.setElementContentStyle(style);
 }