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