• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CaptionStyleCompat类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.exoplayer2.text.CaptionStyleCompat的典型用法代码示例。如果您正苦于以下问题:Java CaptionStyleCompat类的具体用法?Java CaptionStyleCompat怎么用?Java CaptionStyleCompat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CaptionStyleCompat类属于com.google.android.exoplayer2.text包,在下文中一共展示了CaptionStyleCompat类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: SubtitleView

import com.google.android.exoplayer2.text.CaptionStyleCompat; //导入依赖的package包/类
public SubtitleView(Context context, AttributeSet attrs) {
  super(context, attrs);
  painters = new ArrayList<>();
  textSizeType = FRACTIONAL;
  textSize = DEFAULT_TEXT_SIZE_FRACTION;
  applyEmbeddedStyles = true;
  applyEmbeddedFontSizes = true;
  style = CaptionStyleCompat.DEFAULT;
  bottomPaddingFraction = DEFAULT_BOTTOM_PADDING_FRACTION;
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:11,代码来源:SubtitleView.java


示例2: setStyle

import com.google.android.exoplayer2.text.CaptionStyleCompat; //导入依赖的package包/类
/**
 * Sets the caption style.
 *
 * @param style A style for the view.
 */
public void setStyle(CaptionStyleCompat style) {
  if (this.style == style) {
    return;
  }
  this.style = style;
  // Invalidate to trigger drawing.
  invalidate();
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:14,代码来源:SubtitleView.java


示例3: SubtitleView

import com.google.android.exoplayer2.text.CaptionStyleCompat; //导入依赖的package包/类
public SubtitleView(Context context, AttributeSet attrs) {
  super(context, attrs);
  painters = new ArrayList<>();
  textSizeType = FRACTIONAL;
  textSize = DEFAULT_TEXT_SIZE_FRACTION;
  applyEmbeddedStyles = true;
  style = CaptionStyleCompat.DEFAULT;
  bottomPaddingFraction = DEFAULT_BOTTOM_PADDING_FRACTION;
}
 
开发者ID:jcodeing,项目名称:K-Sonic,代码行数:10,代码来源:SubtitleView.java


示例4: drawTextLayout

import com.google.android.exoplayer2.text.CaptionStyleCompat; //导入依赖的package包/类
private void drawTextLayout(Canvas canvas) {
  StaticLayout layout = textLayout;
  if (layout == null) {
    // Nothing to draw.
    return;
  }

  int saveCount = canvas.save();
  canvas.translate(textLeft, textTop);

  if (Color.alpha(windowColor) > 0) {
    paint.setColor(windowColor);
    canvas.drawRect(-textPaddingX, 0, layout.getWidth() + textPaddingX, layout.getHeight(),
        paint);
  }

  if (Color.alpha(backgroundColor) > 0) {
    paint.setColor(backgroundColor);
    float previousBottom = layout.getLineTop(0);
    int lineCount = layout.getLineCount();
    for (int i = 0; i < lineCount; i++) {
      lineBounds.left = layout.getLineLeft(i) - textPaddingX;
      lineBounds.right = layout.getLineRight(i) + textPaddingX;
      lineBounds.top = previousBottom;
      lineBounds.bottom = layout.getLineBottom(i);
      previousBottom = lineBounds.bottom;
      canvas.drawRoundRect(lineBounds, cornerRadius, cornerRadius, paint);
    }
  }

  if (edgeType == CaptionStyleCompat.EDGE_TYPE_OUTLINE) {
    textPaint.setStrokeJoin(Join.ROUND);
    textPaint.setStrokeWidth(outlineWidth);
    textPaint.setColor(edgeColor);
    textPaint.setStyle(Style.FILL_AND_STROKE);
    layout.draw(canvas);
  } else if (edgeType == CaptionStyleCompat.EDGE_TYPE_DROP_SHADOW) {
    textPaint.setShadowLayer(shadowRadius, shadowOffset, shadowOffset, edgeColor);
  } else if (edgeType == CaptionStyleCompat.EDGE_TYPE_RAISED
      || edgeType == CaptionStyleCompat.EDGE_TYPE_DEPRESSED) {
    boolean raised = edgeType == CaptionStyleCompat.EDGE_TYPE_RAISED;
    int colorUp = raised ? Color.WHITE : edgeColor;
    int colorDown = raised ? edgeColor : Color.WHITE;
    float offset = shadowRadius / 2f;
    textPaint.setColor(foregroundColor);
    textPaint.setStyle(Style.FILL);
    textPaint.setShadowLayer(shadowRadius, -offset, -offset, colorUp);
    layout.draw(canvas);
    textPaint.setShadowLayer(shadowRadius, offset, offset, colorDown);
  }

  textPaint.setColor(foregroundColor);
  textPaint.setStyle(Style.FILL);
  layout.draw(canvas);
  textPaint.setShadowLayer(0, 0, 0, 0);

  canvas.restoreToCount(saveCount);
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:59,代码来源:SubtitlePainter.java


示例5: setUserDefaultStyle

import com.google.android.exoplayer2.text.CaptionStyleCompat; //导入依赖的package包/类
/**
 * Sets the caption style to be equivalent to the one returned by
 * {@link CaptioningManager#getUserStyle()}, or to a default style before API level 19.
 */
public void setUserDefaultStyle() {
  setStyle(Util.SDK_INT >= 19 && !isInEditMode()
      ? getUserCaptionStyleV19() : CaptionStyleCompat.DEFAULT);
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:9,代码来源:SubtitleView.java


示例6: getUserCaptionStyleV19

import com.google.android.exoplayer2.text.CaptionStyleCompat; //导入依赖的package包/类
@TargetApi(19)
private CaptionStyleCompat getUserCaptionStyleV19() {
  CaptioningManager captioningManager =
      (CaptioningManager) getContext().getSystemService(Context.CAPTIONING_SERVICE);
  return CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle());
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:7,代码来源:SubtitleView.java


示例7: drawTextLayout

import com.google.android.exoplayer2.text.CaptionStyleCompat; //导入依赖的package包/类
@SuppressWarnings("PMD.NPathComplexity")  // TODO break this method up
private void drawTextLayout(Canvas canvas) {
    StaticLayout layout = textLayout;
    if (layout == null) {
        // Nothing to draw.
        return;
    }

    int saveCount = canvas.save();
    canvas.translate(textLeft, textTop);

    if (Color.alpha(windowColor) > 0) {
        paint.setColor(windowColor);
        canvas.drawRect(-textPaddingX, 0, layout.getWidth() + textPaddingX, layout.getHeight(),
                paint);
    }

    if (Color.alpha(backgroundColor) > 0) {
        paint.setColor(backgroundColor);
        float previousBottom = layout.getLineTop(0);
        int lineCount = layout.getLineCount();
        for (int i = 0; i < lineCount; i++) {
            lineBounds.left = layout.getLineLeft(i) - textPaddingX;
            lineBounds.right = layout.getLineRight(i) + textPaddingX;
            lineBounds.top = previousBottom;
            lineBounds.bottom = layout.getLineBottom(i);
            previousBottom = lineBounds.bottom;
            canvas.drawRoundRect(lineBounds, cornerRadius, cornerRadius, paint);
        }
    }

    if (edgeType == CaptionStyleCompat.EDGE_TYPE_OUTLINE) {
        textPaint.setStrokeJoin(Join.ROUND);
        textPaint.setStrokeWidth(outlineWidth);
        textPaint.setColor(edgeColor);
        textPaint.setStyle(Style.FILL_AND_STROKE);
        layout.draw(canvas);
    } else if (edgeType == CaptionStyleCompat.EDGE_TYPE_DROP_SHADOW) {
        textPaint.setShadowLayer(shadowRadius, shadowOffset, shadowOffset, edgeColor);
    } else if (edgeType == CaptionStyleCompat.EDGE_TYPE_RAISED
            || edgeType == CaptionStyleCompat.EDGE_TYPE_DEPRESSED) {
        boolean raised = edgeType == CaptionStyleCompat.EDGE_TYPE_RAISED;
        int colorUp = raised ? Color.WHITE : edgeColor;
        int colorDown = raised ? edgeColor : Color.WHITE;
        float offset = shadowRadius / 2;
        textPaint.setColor(foregroundColor);
        textPaint.setStyle(Style.FILL);
        textPaint.setShadowLayer(shadowRadius, -offset, -offset, colorUp);
        layout.draw(canvas);
        textPaint.setShadowLayer(shadowRadius, offset, offset, colorDown);
    }

    textPaint.setColor(foregroundColor);
    textPaint.setStyle(Style.FILL);
    layout.draw(canvas);
    textPaint.setShadowLayer(0, 0, 0, 0);

    canvas.restoreToCount(saveCount);
}
 
开发者ID:novoda,项目名称:no-player,代码行数:60,代码来源:SubtitlePainter.java


示例8: drawLayout

import com.google.android.exoplayer2.text.CaptionStyleCompat; //导入依赖的package包/类
/**
 * Draws {@link #textLayout} into the provided canvas.
 *
 * @param canvas The canvas into which to draw.
 */
private void drawLayout(Canvas canvas) {
  final StaticLayout layout = textLayout;
  if (layout == null) {
    // Nothing to draw.
    return;
  }

  int saveCount = canvas.save();
  canvas.translate(textLeft, textTop);

  if (Color.alpha(windowColor) > 0) {
    paint.setColor(windowColor);
    canvas.drawRect(-textPaddingX, 0, layout.getWidth() + textPaddingX, layout.getHeight(),
        paint);
  }

  if (Color.alpha(backgroundColor) > 0) {
    paint.setColor(backgroundColor);
    float previousBottom = layout.getLineTop(0);
    int lineCount = layout.getLineCount();
    for (int i = 0; i < lineCount; i++) {
      lineBounds.left = layout.getLineLeft(i) - textPaddingX;
      lineBounds.right = layout.getLineRight(i) + textPaddingX;
      lineBounds.top = previousBottom;
      lineBounds.bottom = layout.getLineBottom(i);
      previousBottom = lineBounds.bottom;
      canvas.drawRoundRect(lineBounds, cornerRadius, cornerRadius, paint);
    }
  }

  if (edgeType == CaptionStyleCompat.EDGE_TYPE_OUTLINE) {
    textPaint.setStrokeJoin(Join.ROUND);
    textPaint.setStrokeWidth(outlineWidth);
    textPaint.setColor(edgeColor);
    textPaint.setStyle(Style.FILL_AND_STROKE);
    layout.draw(canvas);
  } else if (edgeType == CaptionStyleCompat.EDGE_TYPE_DROP_SHADOW) {
    textPaint.setShadowLayer(shadowRadius, shadowOffset, shadowOffset, edgeColor);
  } else if (edgeType == CaptionStyleCompat.EDGE_TYPE_RAISED
      || edgeType == CaptionStyleCompat.EDGE_TYPE_DEPRESSED) {
    boolean raised = edgeType == CaptionStyleCompat.EDGE_TYPE_RAISED;
    int colorUp = raised ? Color.WHITE : edgeColor;
    int colorDown = raised ? edgeColor : Color.WHITE;
    float offset = shadowRadius / 2f;
    textPaint.setColor(foregroundColor);
    textPaint.setStyle(Style.FILL);
    textPaint.setShadowLayer(shadowRadius, -offset, -offset, colorUp);
    layout.draw(canvas);
    textPaint.setShadowLayer(shadowRadius, offset, offset, colorDown);
  }

  textPaint.setColor(foregroundColor);
  textPaint.setStyle(Style.FILL);
  layout.draw(canvas);
  textPaint.setShadowLayer(0, 0, 0, 0);

  canvas.restoreToCount(saveCount);
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:64,代码来源:SubtitlePainter.java


示例9: setUserDefaultStyle

import com.google.android.exoplayer2.text.CaptionStyleCompat; //导入依赖的package包/类
/**
 * Sets the caption style to be equivalent to the one returned by
 * {@link CaptioningManager#getUserStyle()}, or to a default style on API level 19 and earlier.
 */
public void setUserDefaultStyle() {
  setStyle(Util.SDK_INT >= 19 ? getUserCaptionStyleV19() : CaptionStyleCompat.DEFAULT);
}
 
开发者ID:zhanglibin123488,项目名称:videoPickPlayer,代码行数:8,代码来源:SubtitleView.java



注:本文中的com.google.android.exoplayer2.text.CaptionStyleCompat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ListSubscriptionsResult类代码示例发布时间:2022-05-22
下一篇:
Java MethodRemapper类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap