use of com.android.internal.widget.SubtitleView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PresetPreference method onBindListItem.
@Override
protected void onBindListItem(View view, int index) {
final View previewViewport = view.findViewById(R.id.preview_viewport);
final SubtitleView previewText = (SubtitleView) view.findViewById(R.id.preview);
final int value = getValueAt(index);
CaptionPropertiesFragment.applyCaptionProperties(mCaptioningManager, previewText, previewViewport, value);
final float density = getContext().getResources().getDisplayMetrics().density;
previewText.setTextSize(DEFAULT_FONT_SIZE * density);
final CharSequence title = getTitleAt(index);
if (title != null) {
final TextView summary = (TextView) view.findViewById(R.id.summary);
summary.setText(title);
}
}
use of com.android.internal.widget.SubtitleView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CaptionPropertiesFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final boolean enabled = mCaptioningManager.isEnabled();
mPreviewText = (SubtitleView) view.findViewById(R.id.preview_text);
mPreviewText.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
mPreviewWindow = view.findViewById(R.id.preview_window);
mPreviewViewport = view.findViewById(R.id.preview_viewport);
mPreviewViewport.addOnLayoutChangeListener(new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
refreshPreviewText();
}
});
}
use of com.android.internal.widget.SubtitleView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EdgeTypePreference method onBindListItem.
@Override
protected void onBindListItem(View view, int index) {
final SubtitleView preview = (SubtitleView) view.findViewById(R.id.preview);
preview.setForegroundColor(DEFAULT_FOREGROUND_COLOR);
preview.setBackgroundColor(DEFAULT_BACKGROUND_COLOR);
final float density = getContext().getResources().getDisplayMetrics().density;
preview.setTextSize(DEFAULT_FONT_SIZE * density);
final int value = getValueAt(index);
preview.setEdgeType(value);
preview.setEdgeColor(DEFAULT_EDGE_COLOR);
final CharSequence title = getTitleAt(index);
if (title != null) {
final TextView summary = (TextView) view.findViewById(R.id.summary);
summary.setText(title);
}
}
use of com.android.internal.widget.SubtitleView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CaptionPropertiesFragment method refreshPreviewText.
private void refreshPreviewText() {
final Context context = getActivity();
if (context == null) {
// We've been destroyed, abort!
return;
}
final SubtitleView preview = mPreviewText;
if (preview != null) {
final int styleId = mCaptioningManager.getRawUserStyle();
applyCaptionProperties(mCaptioningManager, preview, mPreviewViewport, styleId);
final Locale locale = mCaptioningManager.getLocale();
if (locale != null) {
final CharSequence localizedText = AccessibilityUtils.getTextForLocale(context, locale, R.string.captioning_preview_text);
preview.setText(localizedText);
} else {
preview.setText(R.string.captioning_preview_text);
}
final CaptionStyle style = mCaptioningManager.getUserStyle();
if (style.hasWindowColor()) {
mPreviewWindow.setBackgroundColor(style.windowColor);
} else {
final CaptionStyle defStyle = CaptionStyle.DEFAULT;
mPreviewWindow.setBackgroundColor(defStyle.windowColor);
}
}
}
Aggregations