Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -29974,9 +29974,11 @@ package android.view.accessibility { public static final class CaptioningManager.CaptionStyle { method public android.graphics.Typeface getTypeface(); field public static final int EDGE_TYPE_DEPRESSED = 4; // 0x4 field public static final int EDGE_TYPE_DROP_SHADOW = 2; // 0x2 field public static final int EDGE_TYPE_NONE = 0; // 0x0 field public static final int EDGE_TYPE_OUTLINE = 1; // 0x1 field public static final int EDGE_TYPE_RAISED = 3; // 0x3 field public final int backgroundColor; field public final int edgeColor; field public final int edgeType; core/java/android/view/accessibility/CaptioningManager.java +15 −4 Original line number Diff line number Diff line Loading @@ -250,6 +250,9 @@ public class CaptioningManager { * background colors, edge properties, and typeface. */ public static final class CaptionStyle { /** Packed value for a color of 'none' and a cached opacity of 100%. */ private static final int COLOR_NONE_OPAQUE = 0x000000FF; private static final CaptionStyle WHITE_ON_BLACK; private static final CaptionStyle BLACK_ON_WHITE; private static final CaptionStyle YELLOW_ON_BLACK; Loading @@ -271,6 +274,12 @@ public class CaptioningManager { /** Edge type value specifying drop-shadowed character edges. */ public static final int EDGE_TYPE_DROP_SHADOW = 2; /** Edge type value specifying raised bevel character edges. */ public static final int EDGE_TYPE_RAISED = 3; /** Edge type value specifying depressed bevel character edges. */ public static final int EDGE_TYPE_DEPRESSED = 4; /** The preferred foreground color for video captions. */ public final int foregroundColor; Loading @@ -283,6 +292,8 @@ public class CaptioningManager { * <li>{@link #EDGE_TYPE_NONE} * <li>{@link #EDGE_TYPE_OUTLINE} * <li>{@link #EDGE_TYPE_DROP_SHADOW} * <li>{@link #EDGE_TYPE_RAISED} * <li>{@link #EDGE_TYPE_DEPRESSED} * </ul> */ public final int edgeType; Loading Loading @@ -352,13 +363,13 @@ public class CaptioningManager { static { WHITE_ON_BLACK = new CaptionStyle(Color.WHITE, Color.BLACK, EDGE_TYPE_NONE, Color.BLACK, Color.TRANSPARENT, null); Color.BLACK, COLOR_NONE_OPAQUE, null); BLACK_ON_WHITE = new CaptionStyle(Color.BLACK, Color.WHITE, EDGE_TYPE_NONE, Color.BLACK, Color.TRANSPARENT, null); Color.BLACK, COLOR_NONE_OPAQUE, null); YELLOW_ON_BLACK = new CaptionStyle(Color.YELLOW, Color.BLACK, EDGE_TYPE_NONE, Color.BLACK, Color.TRANSPARENT, null); Color.BLACK, COLOR_NONE_OPAQUE, null); YELLOW_ON_BLUE = new CaptionStyle(Color.YELLOW, Color.BLUE, EDGE_TYPE_NONE, Color.BLACK, Color.TRANSPARENT, null); Color.BLACK, COLOR_NONE_OPAQUE, null); PRESETS = new CaptionStyle[] { WHITE_ON_BLACK, BLACK_ON_WHITE, YELLOW_ON_BLACK, YELLOW_ON_BLUE Loading core/java/com/android/internal/widget/SubtitleView.java +25 −3 Original line number Diff line number Diff line Loading @@ -39,6 +39,12 @@ public class SubtitleView extends View { // Ratio of inner padding to font size. private static final float INNER_PADDING_RATIO = 0.125f; /** Color used for the shadowed edge of a bevel. */ private static final int COLOR_BEVEL_DARK = 0x80000000; /** Color used for the illuminated edge of a bevel. */ private static final int COLOR_BEVEL_LIGHT = 0x80FFFFFF; // Styled dimensions. private final float mCornerRadius; private final float mOutlineWidth; Loading Loading @@ -113,7 +119,6 @@ public class SubtitleView extends View { // Set up density-dependent properties. // TODO: Move these to a default style. final Resources res = getContext().getResources(); final DisplayMetrics m = res.getDisplayMetrics(); mCornerRadius = res.getDimensionPixelSize(com.android.internal.R.dimen.subtitle_corner_radius); mOutlineWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.subtitle_outline_width); mShadowRadius = res.getDimensionPixelSize(com.android.internal.R.dimen.subtitle_shadow_radius); Loading Loading @@ -312,7 +317,8 @@ public class SubtitleView extends View { } } if (mEdgeType == CaptionStyle.EDGE_TYPE_OUTLINE) { final int edgeType = mEdgeType; if (edgeType == CaptionStyle.EDGE_TYPE_OUTLINE) { textPaint.setStrokeJoin(Join.ROUND); textPaint.setStrokeWidth(mOutlineWidth); textPaint.setColor(mEdgeColor); Loading @@ -321,8 +327,24 @@ public class SubtitleView extends View { for (int i = 0; i < lineCount; i++) { layout.drawText(c, i, i); } } else if (mEdgeType == CaptionStyle.EDGE_TYPE_DROP_SHADOW) { } else if (edgeType == CaptionStyle.EDGE_TYPE_DROP_SHADOW) { textPaint.setShadowLayer(mShadowRadius, mShadowOffsetX, mShadowOffsetY, mEdgeColor); } else if (edgeType == CaptionStyle.EDGE_TYPE_RAISED || edgeType == CaptionStyle.EDGE_TYPE_DEPRESSED) { final boolean raised = edgeType == CaptionStyle.EDGE_TYPE_RAISED; final int colorUp = raised ? Color.WHITE : mEdgeColor; final int colorDown = raised ? mEdgeColor : Color.WHITE; final float offset = mShadowRadius / 2f; textPaint.setColor(mForegroundColor); textPaint.setStyle(Style.FILL); textPaint.setShadowLayer(mShadowRadius, -offset, -offset, colorUp); for (int i = 0; i < lineCount; i++) { layout.drawText(c, i, i); } textPaint.setShadowLayer(mShadowRadius, offset, offset, colorDown); } textPaint.setColor(mForegroundColor); Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -29974,9 +29974,11 @@ package android.view.accessibility { public static final class CaptioningManager.CaptionStyle { method public android.graphics.Typeface getTypeface(); field public static final int EDGE_TYPE_DEPRESSED = 4; // 0x4 field public static final int EDGE_TYPE_DROP_SHADOW = 2; // 0x2 field public static final int EDGE_TYPE_NONE = 0; // 0x0 field public static final int EDGE_TYPE_OUTLINE = 1; // 0x1 field public static final int EDGE_TYPE_RAISED = 3; // 0x3 field public final int backgroundColor; field public final int edgeColor; field public final int edgeType;
core/java/android/view/accessibility/CaptioningManager.java +15 −4 Original line number Diff line number Diff line Loading @@ -250,6 +250,9 @@ public class CaptioningManager { * background colors, edge properties, and typeface. */ public static final class CaptionStyle { /** Packed value for a color of 'none' and a cached opacity of 100%. */ private static final int COLOR_NONE_OPAQUE = 0x000000FF; private static final CaptionStyle WHITE_ON_BLACK; private static final CaptionStyle BLACK_ON_WHITE; private static final CaptionStyle YELLOW_ON_BLACK; Loading @@ -271,6 +274,12 @@ public class CaptioningManager { /** Edge type value specifying drop-shadowed character edges. */ public static final int EDGE_TYPE_DROP_SHADOW = 2; /** Edge type value specifying raised bevel character edges. */ public static final int EDGE_TYPE_RAISED = 3; /** Edge type value specifying depressed bevel character edges. */ public static final int EDGE_TYPE_DEPRESSED = 4; /** The preferred foreground color for video captions. */ public final int foregroundColor; Loading @@ -283,6 +292,8 @@ public class CaptioningManager { * <li>{@link #EDGE_TYPE_NONE} * <li>{@link #EDGE_TYPE_OUTLINE} * <li>{@link #EDGE_TYPE_DROP_SHADOW} * <li>{@link #EDGE_TYPE_RAISED} * <li>{@link #EDGE_TYPE_DEPRESSED} * </ul> */ public final int edgeType; Loading Loading @@ -352,13 +363,13 @@ public class CaptioningManager { static { WHITE_ON_BLACK = new CaptionStyle(Color.WHITE, Color.BLACK, EDGE_TYPE_NONE, Color.BLACK, Color.TRANSPARENT, null); Color.BLACK, COLOR_NONE_OPAQUE, null); BLACK_ON_WHITE = new CaptionStyle(Color.BLACK, Color.WHITE, EDGE_TYPE_NONE, Color.BLACK, Color.TRANSPARENT, null); Color.BLACK, COLOR_NONE_OPAQUE, null); YELLOW_ON_BLACK = new CaptionStyle(Color.YELLOW, Color.BLACK, EDGE_TYPE_NONE, Color.BLACK, Color.TRANSPARENT, null); Color.BLACK, COLOR_NONE_OPAQUE, null); YELLOW_ON_BLUE = new CaptionStyle(Color.YELLOW, Color.BLUE, EDGE_TYPE_NONE, Color.BLACK, Color.TRANSPARENT, null); Color.BLACK, COLOR_NONE_OPAQUE, null); PRESETS = new CaptionStyle[] { WHITE_ON_BLACK, BLACK_ON_WHITE, YELLOW_ON_BLACK, YELLOW_ON_BLUE Loading
core/java/com/android/internal/widget/SubtitleView.java +25 −3 Original line number Diff line number Diff line Loading @@ -39,6 +39,12 @@ public class SubtitleView extends View { // Ratio of inner padding to font size. private static final float INNER_PADDING_RATIO = 0.125f; /** Color used for the shadowed edge of a bevel. */ private static final int COLOR_BEVEL_DARK = 0x80000000; /** Color used for the illuminated edge of a bevel. */ private static final int COLOR_BEVEL_LIGHT = 0x80FFFFFF; // Styled dimensions. private final float mCornerRadius; private final float mOutlineWidth; Loading Loading @@ -113,7 +119,6 @@ public class SubtitleView extends View { // Set up density-dependent properties. // TODO: Move these to a default style. final Resources res = getContext().getResources(); final DisplayMetrics m = res.getDisplayMetrics(); mCornerRadius = res.getDimensionPixelSize(com.android.internal.R.dimen.subtitle_corner_radius); mOutlineWidth = res.getDimensionPixelSize(com.android.internal.R.dimen.subtitle_outline_width); mShadowRadius = res.getDimensionPixelSize(com.android.internal.R.dimen.subtitle_shadow_radius); Loading Loading @@ -312,7 +317,8 @@ public class SubtitleView extends View { } } if (mEdgeType == CaptionStyle.EDGE_TYPE_OUTLINE) { final int edgeType = mEdgeType; if (edgeType == CaptionStyle.EDGE_TYPE_OUTLINE) { textPaint.setStrokeJoin(Join.ROUND); textPaint.setStrokeWidth(mOutlineWidth); textPaint.setColor(mEdgeColor); Loading @@ -321,8 +327,24 @@ public class SubtitleView extends View { for (int i = 0; i < lineCount; i++) { layout.drawText(c, i, i); } } else if (mEdgeType == CaptionStyle.EDGE_TYPE_DROP_SHADOW) { } else if (edgeType == CaptionStyle.EDGE_TYPE_DROP_SHADOW) { textPaint.setShadowLayer(mShadowRadius, mShadowOffsetX, mShadowOffsetY, mEdgeColor); } else if (edgeType == CaptionStyle.EDGE_TYPE_RAISED || edgeType == CaptionStyle.EDGE_TYPE_DEPRESSED) { final boolean raised = edgeType == CaptionStyle.EDGE_TYPE_RAISED; final int colorUp = raised ? Color.WHITE : mEdgeColor; final int colorDown = raised ? mEdgeColor : Color.WHITE; final float offset = mShadowRadius / 2f; textPaint.setColor(mForegroundColor); textPaint.setStyle(Style.FILL); textPaint.setShadowLayer(mShadowRadius, -offset, -offset, colorUp); for (int i = 0; i < lineCount; i++) { layout.drawText(c, i, i); } textPaint.setShadowLayer(mShadowRadius, offset, offset, colorDown); } textPaint.setColor(mForegroundColor); Loading