Java 类android.view.accessibility.CaptioningManager.CaptionStyle 实例源码

项目:airgram    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:airgram    文件:CaptionStyleCompat.java   
@TargetApi(19)
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:airgram    文件:CaptionStyleCompat.java   
@TargetApi(21)
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:PlusGram    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:PlusGram    文件:CaptionStyleCompat.java   
@TargetApi(19)
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:PlusGram    文件:CaptionStyleCompat.java   
@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());
}
项目:Exoplayer2Radio    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:Exoplayer2Radio    文件:CaptionStyleCompat.java   
@TargetApi(19)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:Exoplayer2Radio    文件:CaptionStyleCompat.java   
@TargetApi(21)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:miku    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:miku    文件:CaptionStyleCompat.java   
@TargetApi(19)
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:miku    文件:CaptionStyleCompat.java   
@TargetApi(21)
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:K-Sonic    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:K-Sonic    文件:CaptionStyleCompat.java   
@TargetApi(19)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:K-Sonic    文件:CaptionStyleCompat.java   
@TargetApi(21)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:ExoPlayer-Demo    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:ExoPlayer-Demo    文件:CaptionStyleCompat.java   
@TargetApi(19)
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:ExoPlayer-Demo    文件:CaptionStyleCompat.java   
@TargetApi(21)
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:videoPickPlayer    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:videoPickPlayer    文件:CaptionStyleCompat.java   
@TargetApi(19)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:videoPickPlayer    文件:CaptionStyleCompat.java   
@TargetApi(21)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:android-exoplayer    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:android-exoplayer    文件:CaptionStyleCompat.java   
@TargetApi(19)
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:android-exoplayer    文件:CaptionStyleCompat.java   
@TargetApi(21)
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:365browser    文件:CaptioningStyle.java   
/**
 * 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());
}
项目:365browser    文件:CaptioningChangeDelegate.java   
/**
 * Create a {@link ClosedCaptionEdgeAttribute} object based on the type number.
 *
 * @param type The edge type value specified by the user
 * @param color The color of the edge (e.g. "red")
 * @return The enum object
 */
public static ClosedCaptionEdgeAttribute fromSystemEdgeAttribute(Integer type,
        String color) {
    if (type == null) {
        return NONE;
    }
    if (color == null || color.isEmpty()) {
        sEdgeColor = sDefaultEdgeColor;
    } else {
        sEdgeColor = color;
    }
    // Lollipop adds support for EDGE_TYPE_DEPRESSED and EDGE_TYPE_RAISED.
    switch (type) {
        case CaptionStyle.EDGE_TYPE_OUTLINE:
            return OUTLINE;
        case CaptionStyle.EDGE_TYPE_DROP_SHADOW:
            return DROP_SHADOW;
        case CaptionStyle.EDGE_TYPE_RAISED:
            return RAISED;
        case CaptionStyle.EDGE_TYPE_DEPRESSED:
            return DEPRESSED;
        default:
            // CaptionStyle.EDGE_TYPE_NONE
            // CaptionStyle.EDGE_TYPE_UNSPECIFIED
            return NONE;
    }
}
项目:transistor    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:transistor    文件:CaptionStyleCompat.java   
@TargetApi(19)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:transistor    文件:CaptionStyleCompat.java   
@TargetApi(21)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:Exoplayer_VLC    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:Exoplayer_VLC    文件:CaptionStyleCompat.java   
@TargetApi(19)
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:Exoplayer_VLC    文件:CaptionStyleCompat.java   
@TargetApi(21)
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.CaptionStyle captionStyle) {
  return null;
          /*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());*/
}
项目:ExoPlayer    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:ExoPlayer    文件:CaptionStyleCompat.java   
@TargetApi(19)
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:ExoPlayer    文件:CaptionStyleCompat.java   
@TargetApi(21)
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:Telegram    文件:CaptionStyleCompat.java   
/**
 * Creates a {@link CaptionStyleCompat} equivalent to a provided {@link CaptionStyle}.
 *
 * @param captionStyle A {@link CaptionStyle}.
 * @return The equivalent {@link CaptionStyleCompat}.
 */
@TargetApi(19)
public static CaptionStyleCompat createFromCaptionStyle(
    CaptioningManager.CaptionStyle captionStyle) {
  if (Util.SDK_INT >= 21) {
    return createFromCaptionStyleV21(captionStyle);
  } else {
    // Note - Any caller must be on at least API level 19 or greater (because CaptionStyle did
    // not exist in earlier API levels).
    return createFromCaptionStyleV19(captionStyle);
  }
}
项目:Telegram    文件:CaptionStyleCompat.java   
@TargetApi(19)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
项目:Telegram    文件:CaptionStyleCompat.java   
@TargetApi(21)
@SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV21(
    CaptioningManager.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());
}
项目:android_packages_apps_tv    文件:CaptionWindowLayout.java   
@Override
public void onUserStyleChanged(CaptionStyle userStyle) {
    mCaptionStyleCompat = CaptionStyleCompat.createFromCaptionStyle(userStyle);
    mSubtitleView.setStyle(mCaptionStyleCompat);
    updateWidestChar();
}