Search in sources :

Example 1 with SubtitleView

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);
    }
}
Also used : SubtitleView(com.android.internal.widget.SubtitleView) TextView(android.widget.TextView) TextView(android.widget.TextView) SubtitleView(com.android.internal.widget.SubtitleView) View(android.view.View)

Example 2 with SubtitleView

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();
        }
    });
}
Also used : OnLayoutChangeListener(android.view.View.OnLayoutChangeListener) View(android.view.View) SubtitleView(com.android.internal.widget.SubtitleView)

Example 3 with SubtitleView

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);
    }
}
Also used : SubtitleView(com.android.internal.widget.SubtitleView) TextView(android.widget.TextView)

Example 4 with SubtitleView

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);
        }
    }
}
Also used : Context(android.content.Context) Locale(java.util.Locale) SubtitleView(com.android.internal.widget.SubtitleView) CaptionStyle(android.view.accessibility.CaptioningManager.CaptionStyle)

Aggregations

SubtitleView (com.android.internal.widget.SubtitleView)4 View (android.view.View)2 TextView (android.widget.TextView)2 Context (android.content.Context)1 OnLayoutChangeListener (android.view.View.OnLayoutChangeListener)1 CaptionStyle (android.view.accessibility.CaptioningManager.CaptionStyle)1 Locale (java.util.Locale)1