Search in sources :

Example 21 with CaptionStyle

use of android.view.accessibility.CaptioningManager.CaptionStyle in project android_frameworks_base by crdroidandroid.

the class WebVttRenderingWidget method setActiveCues.

public void setActiveCues(Vector<SubtitleTrack.Cue> activeCues) {
    final Context context = getContext();
    final CaptionStyle captionStyle = mCaptionStyle;
    final float fontSize = mFontSize;
    prepForPrune();
    // Ensure we have all necessary cue and region boxes.
    final int count = activeCues.size();
    for (int i = 0; i < count; i++) {
        final TextTrackCue cue = (TextTrackCue) activeCues.get(i);
        final TextTrackRegion region = cue.mRegion;
        if (region != null) {
            RegionLayout regionBox = mRegionBoxes.get(region);
            if (regionBox == null) {
                regionBox = new RegionLayout(context, region, captionStyle, fontSize);
                mRegionBoxes.put(region, regionBox);
                addView(regionBox, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            }
            regionBox.put(cue);
        } else {
            CueLayout cueBox = mCueBoxes.get(cue);
            if (cueBox == null) {
                cueBox = new CueLayout(context, cue, captionStyle, fontSize);
                mCueBoxes.put(cue, cueBox);
                addView(cueBox, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            }
            cueBox.update();
            cueBox.setOrder(i);
        }
    }
    prune();
    // Force measurement and layout.
    final int width = getWidth();
    final int height = getHeight();
    setSize(width, height);
    if (mListener != null) {
        mListener.onChanged(this);
    }
}
Also used : Context(android.content.Context) CaptionStyle(android.view.accessibility.CaptioningManager.CaptionStyle)

Example 22 with CaptionStyle

use of android.view.accessibility.CaptioningManager.CaptionStyle in project android_frameworks_base by crdroidandroid.

the class Cea608CCWidget method updateDisplay.

private void updateDisplay() {
    if (mListener != null) {
        CaptionStyle captionStyle = mListener.getCaptionStyle();
        mListener.onDisplayChanged(mDisplay.getStyledText(captionStyle));
    }
}
Also used : CaptionStyle(android.view.accessibility.CaptioningManager.CaptionStyle)

Aggregations

CaptionStyle (android.view.accessibility.CaptioningManager.CaptionStyle)22 Context (android.content.Context)11 ContentResolver (android.content.ContentResolver)6 Typeface (android.graphics.Typeface)5 SubtitleView (com.android.internal.widget.SubtitleView)1 Locale (java.util.Locale)1