Additional caption settings for edge styles and window color
Change-Id: Ib967bc566a7b8f7674c696fc05d799e12269ec42
This commit is contained in:
@@ -31,13 +31,19 @@
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/caption_background" />
|
||||
|
||||
<com.android.internal.widget.SubtitleView
|
||||
android:id="@+id/preview_text"
|
||||
android:layout_width="wrap_content"
|
||||
<FrameLayout
|
||||
android:id="@+id/preview_window"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|start"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/captioning_preview_text" />
|
||||
android:padding="16dp" >
|
||||
|
||||
<com.android.internal.widget.SubtitleView
|
||||
android:id="@+id/preview_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/captioning_preview_text" />
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
|
@@ -747,6 +747,8 @@
|
||||
<item>None</item>
|
||||
<item>Outline</item>
|
||||
<item>Drop shadow</item>
|
||||
<item>Raised</item>
|
||||
<item>Depressed</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Values for captioning character edge type preference. -->
|
||||
@@ -754,6 +756,8 @@
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</integer-array>
|
||||
|
||||
<!-- Titles for captioning color preference. -->
|
||||
|
@@ -3379,6 +3379,10 @@
|
||||
<string name="captioning_background_color">Background color</string>
|
||||
<!-- Title for the preference to change video caption background opacity. [CHAR LIMIT=35] -->
|
||||
<string name="captioning_background_opacity">Background opacity</string>
|
||||
<!-- Title for the preference to change video caption window color. [CHAR LIMIT=35] -->
|
||||
<string name="captioning_window_color">Caption window color</string>
|
||||
<!-- Title for the preference to change video caption window opacity. [CHAR LIMIT=35] -->
|
||||
<string name="captioning_window_opacity">Caption window opacity</string>
|
||||
<!-- Title for the preference to change video caption text color. [CHAR LIMIT=35] -->
|
||||
<string name="captioning_foreground_color">Text color</string>
|
||||
<!-- Title for the preference to change video caption text opacity. [CHAR LIMIT=35] -->
|
||||
|
@@ -82,6 +82,15 @@
|
||||
android:key="captioning_background_opacity"
|
||||
android:persistent="false"
|
||||
android:title="@string/captioning_background_opacity" />
|
||||
<com.android.settings.accessibility.ColorPreference
|
||||
android:key="captioning_window_color"
|
||||
android:persistent="false"
|
||||
android:title="@string/captioning_window_color" />
|
||||
<com.android.settings.accessibility.ColorPreference
|
||||
android:dependency="captioning_window_color"
|
||||
android:key="captioning_window_opacity"
|
||||
android:persistent="false"
|
||||
android:title="@string/captioning_window_opacity" />
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@@ -54,6 +54,8 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
private static final String PREF_BACKGROUND_OPACITY = "captioning_background_opacity";
|
||||
private static final String PREF_FOREGROUND_COLOR = "captioning_foreground_color";
|
||||
private static final String PREF_FOREGROUND_OPACITY = "captioning_foreground_opacity";
|
||||
private static final String PREF_WINDOW_COLOR = "captioning_window_color";
|
||||
private static final String PREF_WINDOW_OPACITY = "captioning_window_opacity";
|
||||
private static final String PREF_EDGE_COLOR = "captioning_edge_color";
|
||||
private static final String PREF_EDGE_TYPE = "captioning_edge_type";
|
||||
private static final String PREF_FONT_SIZE = "captioning_font_size";
|
||||
@@ -66,6 +68,7 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
|
||||
private CaptioningManager mCaptioningManager;
|
||||
private SubtitleView mPreviewText;
|
||||
private View mPreviewWindow;
|
||||
|
||||
// Standard options.
|
||||
private LocalePreference mLocale;
|
||||
@@ -80,6 +83,8 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
private ColorPreference mEdgeColor;
|
||||
private ColorPreference mBackgroundColor;
|
||||
private ColorPreference mBackgroundOpacity;
|
||||
private ColorPreference mWindowColor;
|
||||
private ColorPreference mWindowOpacity;
|
||||
private PreferenceCategory mCustom;
|
||||
|
||||
private boolean mShowingCustom;
|
||||
@@ -120,6 +125,7 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mPreviewText = (SubtitleView) view.findViewById(R.id.preview_text);
|
||||
mPreviewWindow = view.findViewById(R.id.preview_window);
|
||||
|
||||
installActionBarToggleSwitch();
|
||||
refreshPreviewText();
|
||||
@@ -145,6 +151,9 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
} else {
|
||||
preview.setText(R.string.captioning_preview_text);
|
||||
}
|
||||
|
||||
final CaptionStyle style = mCaptioningManager.getUserStyle();
|
||||
mPreviewWindow.setBackgroundColor(style.windowColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +255,14 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
mBackgroundOpacity.setTitles(opacityTitles);
|
||||
mBackgroundOpacity.setValues(opacityValues);
|
||||
|
||||
mWindowColor = (ColorPreference) mCustom.findPreference(PREF_WINDOW_COLOR);
|
||||
mWindowColor.setTitles(bgColorTitles);
|
||||
mWindowColor.setValues(bgColorValues);
|
||||
|
||||
mWindowOpacity = (ColorPreference) mCustom.findPreference(PREF_WINDOW_OPACITY);
|
||||
mWindowOpacity.setTitles(opacityTitles);
|
||||
mWindowOpacity.setValues(opacityValues);
|
||||
|
||||
mEdgeType = (EdgeTypePreference) mCustom.findPreference(PREF_EDGE_TYPE);
|
||||
mTypeface = (ListPreference) mCustom.findPreference(PREF_TYPEFACE);
|
||||
}
|
||||
@@ -257,6 +274,8 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
mEdgeColor.setOnValueChangedListener(this);
|
||||
mBackgroundColor.setOnValueChangedListener(this);
|
||||
mBackgroundOpacity.setOnValueChangedListener(this);
|
||||
mWindowColor.setOnValueChangedListener(this);
|
||||
mWindowOpacity.setOnValueChangedListener(this);
|
||||
mEdgeType.setOnValueChangedListener(this);
|
||||
|
||||
mTypeface.setOnPreferenceChangeListener(this);
|
||||
@@ -278,6 +297,7 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
|
||||
parseColorOpacity(mForegroundColor, mForegroundOpacity, attrs.foregroundColor);
|
||||
parseColorOpacity(mBackgroundColor, mBackgroundOpacity, attrs.backgroundColor);
|
||||
parseColorOpacity(mWindowColor, mWindowOpacity, attrs.windowColor);
|
||||
|
||||
final String rawTypeface = attrs.mRawTypeface;
|
||||
mTypeface.setValue(rawTypeface == null ? "" : rawTypeface);
|
||||
@@ -334,6 +354,10 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
final int merged = mergeColorOpacity(mBackgroundColor, mBackgroundOpacity);
|
||||
Settings.Secure.putInt(
|
||||
cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, merged);
|
||||
} else if (mWindowColor == preference || mWindowOpacity == preference) {
|
||||
final int merged = mergeColorOpacity(mWindowColor, mWindowOpacity);
|
||||
Settings.Secure.putInt(
|
||||
cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_WINDOW_COLOR, merged);
|
||||
} else if (mEdgeColor == preference) {
|
||||
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_EDGE_COLOR, value);
|
||||
} else if (mPreset == preference) {
|
||||
|
Reference in New Issue
Block a user