当前位置: 首页>>代码示例>>Java>>正文


Java CaptioningManager类代码示例

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


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

示例1: CaptionWindowLayout

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
public CaptionWindowLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    // Add a subtitle view to the layout.
    mSubtitleView = new SubtitleView(context);
    LayoutParams params = new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    addView(mSubtitleView, params);

    // Set the system wide cc preferences to the subtitle view.
    CaptioningManager captioningManager =
            (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE);
    mFontScale = captioningManager.getFontScale();
    mCaptionStyleCompat =
            CaptionStyleCompat.createFromCaptionStyle(captioningManager.getUserStyle());
    mSubtitleView.setStyle(mCaptionStyleCompat);
    mSubtitleView.setText("");
    captioningManager.addCaptioningChangeListener(new SystemWideCaptioningChangeListener());
    updateWidestChar();
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:21,代码来源:CaptionWindowLayout.java

示例2: onCreate

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    mHandlerThread = new HandlerThread(getClass().getSimpleName());
    mHandlerThread.start();
    mDbHandler = new Handler(mHandlerThread.getLooper());
    mCaptioningManager = (CaptioningManager) getSystemService(Context.CAPTIONING_SERVICE);

    setTheme(android.R.style.Theme_Holo_Light_NoActionBar);

    mSessions = new ArrayList<>();
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(TvInputManager.ACTION_BLOCKED_RATINGS_CHANGED);
    intentFilter.addAction(TvInputManager.ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED);
    registerReceiver(mParentalControlsBroadcastReceiver, intentFilter);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:17,代码来源:RichTvInputService.java

示例3: createFromCaptionStyle

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
/**
 * 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);
  }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:18,代码来源:CaptionStyleCompat.java

示例4: createFromCaptionStyleV19

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@TargetApi(19)
private static CaptionStyleCompat createFromCaptionStyleV19(
    CaptioningManager.CaptionStyle captionStyle) {
  return new CaptionStyleCompat(
      captionStyle.foregroundColor, captionStyle.backgroundColor, Color.TRANSPARENT,
      captionStyle.edgeType, captionStyle.edgeColor, captionStyle.getTypeface());
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:8,代码来源:CaptionStyleCompat.java

示例5: createFromCaptionStyleV21

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@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());
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:12,代码来源:CaptionStyleCompat.java

示例6: registerCaptionListener

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@SuppressLint("NewApi")
private void registerCaptionListener(final Context context) {
    if (Utils.IS_KITKAT_OR_ABOVE) {
        CaptioningManager captioningManager =
                (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE);
        captioningManager.addCaptioningChangeListener(
                new CaptioningManager.CaptioningChangeListener() {
                    @Override
                    public void onEnabledChanged(boolean enabled) {
                        onTextTrackEnabledChanged(enabled);
                    }

                    @Override
                    public void onUserStyleChanged(
                            @NonNull CaptioningManager.CaptionStyle userStyle) {
                        onTextTrackStyleChanged(mTrackManager.getTextTrackStyle());
                    }

                    @Override
                    public void onFontScaleChanged(float fontScale) {
                        onTextTrackStyleChanged(mTrackManager.getTextTrackStyle());
                    }

                    @Override
                    public void onLocaleChanged(Locale locale) {
                        onTextTrackLocaleChanged(locale);
                    }
                }
        );
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:32,代码来源:VideoCastManager.java

示例7: isCaptionEnabled

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@SuppressLint("NewApi")
public boolean isCaptionEnabled() {
    if (Utils.IS_KITKAT_OR_ABOVE) {
        CaptioningManager captioningManager =
                (CaptioningManager) mContext.getSystemService(Context.CAPTIONING_SERVICE);
        return captioningManager.isEnabled();
    } else {
        return mPreferenceAccessor.getBooleanFromPreference(
                mContext.getString(R.string.ccl_key_caption_enabled), false);
    }
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:12,代码来源:TracksPreferenceManager.java

示例8: createFromCaptionStyleV19

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@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());
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:9,代码来源:CaptionStyleCompat.java

示例9: createFromCaptionStyleV21

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@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());
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:13,代码来源:CaptionStyleCompat.java

示例10: TunerSessionWorker

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
public TunerSessionWorker(Context context, ChannelDataManager channelDataManager,
            BufferManager bufferManager, TunerSession tunerSession) {
    if (DEBUG) Log.d(TAG, "TunerSessionWorker created");
    mContext = context;

    // HandlerThread should be set up before it is registered as a listener in the all other
    // components.
    HandlerThread handlerThread = new HandlerThread(TAG);
    handlerThread.start();
    mHandler = new Handler(handlerThread.getLooper(), this);
    mSession = tunerSession;
    mChannelDataManager = channelDataManager;
    mChannelDataManager.setListener(this);
    mChannelDataManager.checkDataVersion(mContext);
    mSourceManager = TsDataSourceManager.createSourceManager(false);
    mTvInputManager = (TvInputManager) context.getSystemService(Context.TV_INPUT_SERVICE);
    mTvTracks = new ArrayList<>();
    mAudioTrackMap = new SparseArray<>();
    mCaptionTrackMap = new SparseArray<>();
    CaptioningManager captioningManager =
            (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE);
    mCaptionEnabled = captioningManager.isEnabled();
    mPlaybackParams.setSpeed(1.0f);
    mBufferManager = bufferManager;
    mPreparingStartTimeMs = INVALID_TIME;
    mBufferingStartTimeMs = INVALID_TIME;
    mReadyStartTimeMs = INVALID_TIME;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:29,代码来源:TunerSessionWorker.java

示例11: registerCaptionListener

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@SuppressLint("NewApi")
private void registerCaptionListener(final Context context) {
    if (Utils.IS_KITKAT_OR_ABOVE) {
        CaptioningManager captioningManager =
                (CaptioningManager) context.getSystemService(Context.CAPTIONING_SERVICE);
        captioningManager.addCaptioningChangeListener(
                new CaptioningManager.CaptioningChangeListener() {
                    @Override
                    public void onEnabledChanged(boolean enabled) {
                        onTextTrackEnabledChanged(enabled);
                    }

                    @Override
                    public void onUserStyleChanged(
                            CaptioningManager.CaptionStyle userStyle) {
                        onTextTrackStyleChanged(mTrackManager.getTextTrackStyle());
                    }

                    @Override
                    public void onFontScaleChanged(float fontScale) {
                        onTextTrackStyleChanged(mTrackManager.getTextTrackStyle());
                    }

                    @Override
                    public void onLocaleChanged(Locale locale) {
                        onTextTrackLocaleChanged(locale);
                    }
                }
        );
    }
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:32,代码来源:VideoCastManager.java

示例12: isCaptionEnabled

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@SuppressLint("NewApi")
public boolean isCaptionEnabled() {
    if (Utils.IS_KITKAT_OR_ABOVE) {
        CaptioningManager captioningManager =
                (CaptioningManager) mContext.getSystemService(Context.CAPTIONING_SERVICE);
        return captioningManager.isEnabled();
    } else {
        return Utils.getBooleanFromPreference(mContext,
                mContext.getString(R.string.ccl_key_caption_enabled), false);
    }
}
 
开发者ID:BruGTUG,项目名称:codelab-chromecast,代码行数:12,代码来源:TracksPreferenceManager.java

示例13: TvSession

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param sessionListener Listener through which reporting when session onRelease() is called.
 */
public TvSession(Context context, ITvSession sessionListener, String inputID) {
    super(context);
    mLog.d("[TvSession][Started!]");
    mTvManager = (TvInputManager) context.getSystemService(Context.TV_INPUT_SERVICE);
    mInputID = inputID;
    mSessionListener = sessionListener;
    mContext = context;
    mIsSubtitleEnabled = ((CaptioningManager) mContext
            .getSystemService(Context.CAPTIONING_SERVICE)).isEnabled();
    mDtvManager = DtvManager.getInstance();
    mChannelManager = mDtvManager.getChannelManager();
    mSubtitleManager = mDtvManager.getSubtitleManager();
    mAudioManager = mDtvManager.getAudioManager();
}
 
开发者ID:iWedia,项目名称:iWediaSimpleTvInputService,代码行数:20,代码来源:TvSession.java

示例14: KitKatCaptioningBridge

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:12,代码来源:KitKatCaptioningBridge.java

示例15: createFromCaptionStyleV21

import android.view.accessibility.CaptioningManager; //导入依赖的package包/类
@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());*/
}
 
开发者ID:tyazid,项目名称:Exoplayer_VLC,代码行数:13,代码来源:CaptionStyleCompat.java


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