本文整理汇总了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();
}
示例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);
}
示例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);
}
}
示例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());
}
示例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());
}
示例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);
}
}
);
}
}
示例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);
}
}
示例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());
}
示例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());
}
示例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;
}
示例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);
}
}
);
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例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());*/
}