android.view.accessibility.CaptioningManager Java Examples
The following examples show how to use
android.view.accessibility.CaptioningManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TrackSelectionParameters.java From MediaSDK with Apache License 2.0 | 6 votes |
@TargetApi(19) private void setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettingsV19( Context context) { if (Util.SDK_INT < 23 && Looper.myLooper() == null) { // Android platform bug (pre-Marshmallow) that causes RuntimeExceptions when // CaptioningService is instantiated from a non-Looper thread. See [internal: b/143779904]. return; } CaptioningManager captioningManager = (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE); if (captioningManager == null || !captioningManager.isEnabled()) { return; } preferredTextRoleFlags = C.ROLE_FLAG_CAPTION | C.ROLE_FLAG_DESCRIBES_MUSIC_AND_SOUND; Locale preferredLocale = captioningManager.getLocale(); if (preferredLocale != null) { preferredTextLanguage = Util.getLocaleLanguageTag(preferredLocale); } }
Example #2
Source File: LocaleUtils.java From edx-app-android with Apache License 2.0 | 6 votes |
/** * Utility method that return the Current language code of the device * * @param context - current {@link Context}of the application * @return current language code */ public static String getCurrentDeviceLanguage(Context context) { final CaptioningManager captionManager = (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE); String languageCode = null; // Check if captioning is enabled in accessibility settings if (captionManager.isEnabled()) { final Locale cManagerLocale = captionManager.getLocale(); if (cManagerLocale != null) { languageCode = cManagerLocale.getLanguage(); } } if (TextUtils.isEmpty(languageCode)) { languageCode = Locale.getDefault().getLanguage(); } // Android return iw in case of Hebrew if ("iw".equals(languageCode)) { languageCode = "he"; } return languageCode; }
Example #3
Source File: CaptionStyleCompat.java From Telegram with GNU General Public License v2.0 | 5 votes |
@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()); }
Example #4
Source File: CaptionStyleCompat.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
/** * 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); } }
Example #5
Source File: CaptionStyleCompat.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@TargetApi(19) private static CaptionStyleCompat createFromCaptionStyleV19( CaptioningManager.CaptionStyle captionStyle) { return new CaptionStyleCompat( captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT, captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface()); }
Example #6
Source File: KitKatCaptioningBridge.java From 365browser with Apache License 2.0 | 5 votes |
/** * Construct a new KitKat+ captioning bridge * * @param context the Context to associate with this bridge. */ private KitKatCaptioningBridge(Context context) { mCaptioningChangeDelegate = new CaptioningChangeDelegate(); mCaptioningManager = (CaptioningManager) context.getApplicationContext().getSystemService( Context.CAPTIONING_SERVICE); }
Example #7
Source File: CaptionStyleCompat.java From Exoplayer_VLC with Apache License 2.0 | 5 votes |
@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());*/ }
Example #8
Source File: CaptionStyleCompat.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example #9
Source File: CaptionStyleCompat.java From K-Sonic with MIT License | 5 votes |
@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()); }
Example #10
Source File: CaptionStyleCompat.java From K-Sonic with MIT License | 5 votes |
@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()); }
Example #11
Source File: CaptionStyleCompat.java From K-Sonic with MIT License | 5 votes |
/** * 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); } }
Example #12
Source File: CaptionStyleCompat.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@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()); }
Example #13
Source File: CaptionStyleCompat.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@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()); }
Example #14
Source File: CaptionStyleCompat.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example #15
Source File: CaptionStyleCompat.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@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()); }
Example #16
Source File: CaptionStyleCompat.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@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()); }
Example #17
Source File: CaptionStyleCompat.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@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()); }
Example #18
Source File: CaptionStyleCompat.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example #19
Source File: CaptionStyleCompat.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@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()); }
Example #20
Source File: CaptionStyleCompat.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example #21
Source File: CaptionStyleCompat.java From Telegram with GNU General Public License v2.0 | 5 votes |
@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()); }
Example #22
Source File: RichTvInputService.java From androidtv-sample-inputs with Apache License 2.0 | 4 votes |
@Override public void onCreate() { super.onCreate(); mCaptioningManager = (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE); }
Example #23
Source File: VideoPlayerActivity.java From droidkaigi2016 with Apache License 2.0 | 4 votes |
@TargetApi(19) private CaptionStyleCompat getUserCaptionStyleV19() { CaptioningManager captioningManager = (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE); return CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle()); }
Example #24
Source File: VideoPlayerActivity.java From droidkaigi2016 with Apache License 2.0 | 4 votes |
@TargetApi(19) private float getUserCaptionFontScaleV19() { CaptioningManager captioningManager = (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE); return captioningManager.getFontScale(); }
Example #25
Source File: KitKatCaptioningBridge.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void onUserStyleChanged(CaptioningManager.CaptionStyle userStyle) { final CaptioningStyle captioningStyle = getCaptioningStyleFrom(userStyle); mCaptioningChangeDelegate.onUserStyleChanged(captioningStyle); }
Example #26
Source File: PlayerActivity.java From Exoplayer_VLC with Apache License 2.0 | 4 votes |
@TargetApi(19) private CaptionStyleCompat getUserCaptionStyleV19() { CaptioningManager captioningManager = (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE); return CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle()); }
Example #27
Source File: PlayerActivity.java From Exoplayer_VLC with Apache License 2.0 | 4 votes |
@TargetApi(19) private float getUserCaptionFontScaleV19() { CaptioningManager captioningManager = (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE); return captioningManager.getFontScale(); }
Example #28
Source File: CumulusTvTifService.java From CumulusTV with MIT License | 4 votes |
@Override public void onCreate() { super.onCreate(); mCaptioningManager = (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE); }
Example #29
Source File: VideoPlayerView.java From iview-android-tv with MIT License | 4 votes |
@TargetApi(19) private CaptionStyleCompat getUserCaptionStyleV19() { CaptioningManager captioningManager = (CaptioningManager) mContext.getSystemService(Context.CAPTIONING_SERVICE); return CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle()); }
Example #30
Source File: VideoPlayerView.java From iview-android-tv with MIT License | 4 votes |
@TargetApi(19) private float getUserCaptionFontScaleV19() { CaptioningManager captioningManager = (CaptioningManager) mContext.getSystemService(Context.CAPTIONING_SERVICE); return captioningManager.getFontScale(); }