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);
}
}
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));
}
}
Aggregations