diff options
| author | Alan Viverette <alanv@google.com> | 2013-12-19 11:31:36 -0800 |
|---|---|---|
| committer | Alan Viverette <alanv@google.com> | 2013-12-19 11:31:36 -0800 |
| commit | d07c16107d7cda495a8a2655cdcb0ad552d25a84 (patch) | |
| tree | ae99b68a254da31845fc3e424c48bc4d2c736b0d /src/com/android/settings/accessibility | |
| parent | 1bb8618339425961154b7f86dbce495591f7f2a5 (diff) | |
| download | packages_apps_Settings-d07c16107d7cda495a8a2655cdcb0ad552d25a84.tar.gz packages_apps_Settings-d07c16107d7cda495a8a2655cdcb0ad552d25a84.tar.bz2 packages_apps_Settings-d07c16107d7cda495a8a2655cdcb0ad552d25a84.zip | |
Additional caption settings for edge styles and window color
Change-Id: Ib967bc566a7b8f7674c696fc05d799e12269ec42
Diffstat (limited to 'src/com/android/settings/accessibility')
| -rw-r--r-- | src/com/android/settings/accessibility/CaptionPropertiesFragment.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java index 8a08d90ed..324c595d7 100644 --- a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java +++ b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java @@ -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) { |
