本文整理汇总了Java中android.view.accessibility.CaptioningManager.CaptionStyle.hasEdgeColor方法的典型用法代码示例。如果您正苦于以下问题:Java CaptionStyle.hasEdgeColor方法的具体用法?Java CaptionStyle.hasEdgeColor怎么用?Java CaptionStyle.hasEdgeColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.CaptioningManager.CaptionStyle
的用法示例。
在下文中一共展示了CaptionStyle.hasEdgeColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFromCaptionStyleV21
import android.view.accessibility.CaptioningManager.CaptionStyle; //导入方法依赖的package包/类
@TargetApi(21)
private static CaptionStyleCompat createFromCaptionStyleV21(
CaptionStyle captionStyle) {
return new CaptionStyleCompat(
captionStyle.hasForegroundColor() ? captionStyle.foregroundColor : DEFAULT.foregroundColor,
captionStyle.hasBackgroundColor() ? captionStyle.backgroundColor : DEFAULT.backgroundColor,
captionStyle.hasWindowColor() ? captionStyle.windowColor : DEFAULT.windowColor,
captionStyle.hasEdgeType() ? captionStyle.edgeType : DEFAULT.edgeType,
captionStyle.hasEdgeColor() ? captionStyle.edgeColor : DEFAULT.edgeColor,
captionStyle.getTypeface());
}
示例2: createFrom
import android.view.accessibility.CaptioningManager.CaptionStyle; //导入方法依赖的package包/类
/**
* Converts from a platform CaptionStyle to a Chromium CaptioningStyle. In the case that null
* is passed in, a CaptioningStyle that includes no settings is returned.
* This is safe to call on KitKat.
*
* KitKat CaptionStyle supported neither windowColor nor a few enum values of edgeType.
*
* @param captionStyle an Android platform CaptionStyle object
* @return a Chromium CaptioningStyle object
*/
@SuppressLint("NewApi")
public static CaptioningStyle createFrom(CaptionStyle captionStyle) {
if (captionStyle == null) {
return new CaptioningStyle(null, null, null, null, null, null);
}
Integer backgroundColor = null;
Integer edgeColor = null;
Integer edgeType = null;
Integer foregroundColor = null;
Integer windowColor = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (captionStyle.hasBackgroundColor()) {
backgroundColor = Integer.valueOf(captionStyle.backgroundColor);
}
if (captionStyle.hasEdgeColor()) {
edgeColor = Integer.valueOf(captionStyle.edgeColor);
}
if (captionStyle.hasEdgeType()) {
edgeType = Integer.valueOf(captionStyle.edgeType);
}
if (captionStyle.hasForegroundColor()) {
foregroundColor = Integer.valueOf(captionStyle.foregroundColor);
}
if (captionStyle.hasWindowColor()) {
windowColor = Integer.valueOf(captionStyle.windowColor);
}
} else {
backgroundColor = Integer.valueOf(captionStyle.backgroundColor);
edgeColor = Integer.valueOf(captionStyle.edgeColor);
edgeType = Integer.valueOf(captionStyle.edgeType);
foregroundColor = Integer.valueOf(captionStyle.foregroundColor);
}
return new CaptioningStyle(backgroundColor, edgeColor, edgeType, foregroundColor,
windowColor, captionStyle.getTypeface());
}