Update captioning settings to match final design
BUG: 9926077 Change-Id: I058c05643f33aca89327f23bcdee53dd8afb3bbb
This commit is contained in:
@@ -15,19 +15,12 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@android:id/list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="300dp"
|
||||||
android:orientation="vertical" >
|
android:columnWidth="112dp"
|
||||||
|
android:numColumns="auto_fit"
|
||||||
<GridView
|
android:paddingTop="16dp"
|
||||||
android:id="@android:id/list"
|
android:stretchMode="spacingWidthUniform"
|
||||||
android:layout_width="match_parent"
|
android:verticalSpacing="16dp" />
|
||||||
android:layout_height="400dp"
|
|
||||||
android:columnWidth="112dp"
|
|
||||||
android:numColumns="auto_fit"
|
|
||||||
android:stretchMode="spacingWidthUniform"
|
|
||||||
android:verticalSpacing="16dp"
|
|
||||||
android:paddingTop="16dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
@@ -759,7 +759,6 @@
|
|||||||
<!-- Titles for captioning color preference. -->
|
<!-- Titles for captioning color preference. -->
|
||||||
<string-array name="captioning_color_selector_titles" translatable="false" >
|
<string-array name="captioning_color_selector_titles" translatable="false" >
|
||||||
<item>@string/color_white</item>
|
<item>@string/color_white</item>
|
||||||
<item>@string/color_gray</item>
|
|
||||||
<item>@string/color_black</item>
|
<item>@string/color_black</item>
|
||||||
<item>@string/color_red</item>
|
<item>@string/color_red</item>
|
||||||
<item>@string/color_yellow</item>
|
<item>@string/color_yellow</item>
|
||||||
@@ -772,35 +771,6 @@
|
|||||||
<!-- Values for captioning color preference. -->
|
<!-- Values for captioning color preference. -->
|
||||||
<integer-array name="captioning_color_selector_values" translatable="false" >
|
<integer-array name="captioning_color_selector_values" translatable="false" >
|
||||||
<item>0xFFFFFFFF</item>
|
<item>0xFFFFFFFF</item>
|
||||||
<item>0xFF808080</item>
|
|
||||||
<item>0xFF000000</item>
|
|
||||||
<item>0xFFFF0000</item>
|
|
||||||
<item>0xFFFFFF00</item>
|
|
||||||
<item>0xFF00FF00</item>
|
|
||||||
<item>0xFF00FFFF</item>
|
|
||||||
<item>0xFF0000FF</item>
|
|
||||||
<item>0xFFFF00FF</item>
|
|
||||||
</integer-array>
|
|
||||||
|
|
||||||
<!-- Titles for captioning background color preference. -->
|
|
||||||
<string-array name="captioning_background_color_selector_titles" translatable="false" >
|
|
||||||
<item>@string/color_none</item>
|
|
||||||
<item>@string/color_white</item>
|
|
||||||
<item>@string/color_gray</item>
|
|
||||||
<item>@string/color_black</item>
|
|
||||||
<item>@string/color_red</item>
|
|
||||||
<item>@string/color_yellow</item>
|
|
||||||
<item>@string/color_green</item>
|
|
||||||
<item>@string/color_cyan</item>
|
|
||||||
<item>@string/color_blue</item>
|
|
||||||
<item>@string/color_magenta</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<!-- Values for captioning background color preference. -->
|
|
||||||
<integer-array name="captioning_background_color_selector_values" translatable="false" >
|
|
||||||
<item>0x00000000</item>
|
|
||||||
<item>0xFFFFFFFF</item>
|
|
||||||
<item>0xFF808080</item>
|
|
||||||
<item>0xFF000000</item>
|
<item>0xFF000000</item>
|
||||||
<item>0xFFFF0000</item>
|
<item>0xFFFF0000</item>
|
||||||
<item>0xFFFFFF00</item>
|
<item>0xFFFFFF00</item>
|
||||||
@@ -808,6 +778,62 @@
|
|||||||
<item>0xFF00FFFF</item>
|
<item>0xFF00FFFF</item>
|
||||||
<item>0xFF0000FF</item>
|
<item>0xFF0000FF</item>
|
||||||
<item>0xFFFF00FF</item>
|
<item>0xFFFF00FF</item>
|
||||||
|
<item>0xFF000055</item>
|
||||||
|
<item>0xFF0000AA</item>
|
||||||
|
<item>0xFF005500</item>
|
||||||
|
<item>0xFF005555</item>
|
||||||
|
<item>0xFF0055AA</item>
|
||||||
|
<item>0xFF0055FF</item>
|
||||||
|
<item>0xFF00AA00</item>
|
||||||
|
<item>0xFF00AA55</item>
|
||||||
|
<item>0xFF00AAAA</item>
|
||||||
|
<item>0xFF00AAFF</item>
|
||||||
|
<item>0xFF00FF55</item>
|
||||||
|
<item>0xFF00FFAA</item>
|
||||||
|
<item>0xFF550000</item>
|
||||||
|
<item>0xFF550055</item>
|
||||||
|
<item>0xFF5500AA</item>
|
||||||
|
<item>0xFF5500FF</item>
|
||||||
|
<item>0xFF555500</item>
|
||||||
|
<item>0xFF555555</item>
|
||||||
|
<item>0xFF5555AA</item>
|
||||||
|
<item>0xFF5555FF</item>
|
||||||
|
<item>0xFF55AA00</item>
|
||||||
|
<item>0xFF55AA55</item>
|
||||||
|
<item>0xFF55AAAA</item>
|
||||||
|
<item>0xFF55AAFF</item>
|
||||||
|
<item>0xFF55FF00</item>
|
||||||
|
<item>0xFF55FF55</item>
|
||||||
|
<item>0xFF55FFAA</item>
|
||||||
|
<item>0xFF55FFFF</item>
|
||||||
|
<item>0xFFAA0000</item>
|
||||||
|
<item>0xFFAA0055</item>
|
||||||
|
<item>0xFFAA00AA</item>
|
||||||
|
<item>0xFFAA00FF</item>
|
||||||
|
<item>0xFFAA5500</item>
|
||||||
|
<item>0xFFAA5555</item>
|
||||||
|
<item>0xFFAA55AA</item>
|
||||||
|
<item>0xFFAA55FF</item>
|
||||||
|
<item>0xFFAAAA00</item>
|
||||||
|
<item>0xFFAAAA55</item>
|
||||||
|
<item>0xFFAAAAAA</item>
|
||||||
|
<item>0xFFAAAAFF</item>
|
||||||
|
<item>0xFFAAFF00</item>
|
||||||
|
<item>0xFFAAFF55</item>
|
||||||
|
<item>0xFFAAFFAA</item>
|
||||||
|
<item>0xFFAAFFFF</item>
|
||||||
|
<item>0xFFFF0055</item>
|
||||||
|
<item>0xFFFF00AA</item>
|
||||||
|
<item>0xFFFF5500</item>
|
||||||
|
<item>0xFFFF5555</item>
|
||||||
|
<item>0xFFFF55AA</item>
|
||||||
|
<item>0xFFFF55FF</item>
|
||||||
|
<item>0xFFFFAA00</item>
|
||||||
|
<item>0xFFFFAA55</item>
|
||||||
|
<item>0xFFFFAAAA</item>
|
||||||
|
<item>0xFFFFAAFF</item>
|
||||||
|
<item>0xFFFFFF55</item>
|
||||||
|
<item>0xFFFFFFAA</item>
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
<!-- Titles for captioning opacity preference. [CHAR LIMIT=35] -->
|
<!-- Titles for captioning opacity preference. [CHAR LIMIT=35] -->
|
||||||
|
@@ -3299,6 +3299,8 @@
|
|||||||
<string name="color_yellow">Yellow</string>
|
<string name="color_yellow">Yellow</string>
|
||||||
<!-- Label for the color magenta. [CHAR LIMIT=35] -->
|
<!-- Label for the color magenta. [CHAR LIMIT=35] -->
|
||||||
<string name="color_magenta">Magenta</string>
|
<string name="color_magenta">Magenta</string>
|
||||||
|
<!-- Label for custom colors, formats as a HTML color. -->
|
||||||
|
<string name="color_custom" translatable="false">#%1$02X%2$02X%3$02X</string>
|
||||||
|
|
||||||
<!-- Title for a warning about security implications of enabling an accessibility
|
<!-- Title for a warning about security implications of enabling an accessibility
|
||||||
service. [CHAR LIMIT=NONE] -->
|
service. [CHAR LIMIT=NONE] -->
|
||||||
|
@@ -47,7 +47,6 @@
|
|||||||
android:key="custom"
|
android:key="custom"
|
||||||
android:title="@string/captioning_custom_options_title" >
|
android:title="@string/captioning_custom_options_title" >
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:dependency="captioning_preset"
|
|
||||||
android:entries="@array/captioning_typeface_selector_titles"
|
android:entries="@array/captioning_typeface_selector_titles"
|
||||||
android:entryValues="@array/captioning_typeface_selector_values"
|
android:entryValues="@array/captioning_typeface_selector_values"
|
||||||
android:key="captioning_typeface"
|
android:key="captioning_typeface"
|
||||||
@@ -56,13 +55,11 @@
|
|||||||
android:title="@string/captioning_typeface" />
|
android:title="@string/captioning_typeface" />
|
||||||
|
|
||||||
<com.android.settings.accessibility.ColorPreference
|
<com.android.settings.accessibility.ColorPreference
|
||||||
android:dependency="captioning_preset"
|
|
||||||
android:key="captioning_foreground_color"
|
android:key="captioning_foreground_color"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/captioning_foreground_color" />
|
android:title="@string/captioning_foreground_color" />
|
||||||
|
|
||||||
<com.android.settings.accessibility.EdgeTypePreference
|
<com.android.settings.accessibility.EdgeTypePreference
|
||||||
android:dependency="captioning_preset"
|
|
||||||
android:key="captioning_edge_type"
|
android:key="captioning_edge_type"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/captioning_edge_type" />
|
android:title="@string/captioning_edge_type" />
|
||||||
@@ -73,7 +70,6 @@
|
|||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/captioning_edge_color" />
|
android:title="@string/captioning_edge_color" />
|
||||||
<com.android.settings.accessibility.ColorPreference
|
<com.android.settings.accessibility.ColorPreference
|
||||||
android:dependency="captioning_preset"
|
|
||||||
android:key="captioning_background_color"
|
android:key="captioning_background_color"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/captioning_background_color" />
|
android:title="@string/captioning_background_color" />
|
||||||
|
@@ -22,6 +22,7 @@ import android.graphics.Color;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceCategory;
|
||||||
import android.preference.Preference.OnPreferenceChangeListener;
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.view.accessibility.CaptioningManager;
|
import android.view.accessibility.CaptioningManager;
|
||||||
@@ -50,6 +51,9 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
|||||||
private ColorPreference mEdgeColor;
|
private ColorPreference mEdgeColor;
|
||||||
private ColorPreference mBackgroundColor;
|
private ColorPreference mBackgroundColor;
|
||||||
private ColorPreference mBackgroundOpacity;
|
private ColorPreference mBackgroundOpacity;
|
||||||
|
private PreferenceCategory mCustom;
|
||||||
|
|
||||||
|
private boolean mShowingCustom;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
@@ -57,6 +61,7 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
|||||||
addPreferencesFromResource(R.xml.captioning_settings);
|
addPreferencesFromResource(R.xml.captioning_settings);
|
||||||
initializeAllPreferences();
|
initializeAllPreferences();
|
||||||
updateAllPreferences();
|
updateAllPreferences();
|
||||||
|
refreshShowingCustom();
|
||||||
installUpdateListeners();
|
installUpdateListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +75,9 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeAllPreferences() {
|
private void initializeAllPreferences() {
|
||||||
|
mLocale = (LocalePreference) findPreference("captioning_locale");
|
||||||
|
mFontSize = (ListPreference) findPreference("captioning_font_size");
|
||||||
|
|
||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
final int[] presetValues = res.getIntArray(R.array.captioning_preset_selector_values);
|
final int[] presetValues = res.getIntArray(R.array.captioning_preset_selector_values);
|
||||||
final String[] presetTitles = res.getStringArray(R.array.captioning_preset_selector_titles);
|
final String[] presetTitles = res.getStringArray(R.array.captioning_preset_selector_titles);
|
||||||
@@ -77,34 +85,39 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
|||||||
mPreset.setValues(presetValues);
|
mPreset.setValues(presetValues);
|
||||||
mPreset.setTitles(presetTitles);
|
mPreset.setTitles(presetTitles);
|
||||||
|
|
||||||
|
mCustom = (PreferenceCategory) findPreference("custom");
|
||||||
|
mShowingCustom = true;
|
||||||
|
|
||||||
final int[] colorValues = res.getIntArray(R.array.captioning_color_selector_values);
|
final int[] colorValues = res.getIntArray(R.array.captioning_color_selector_values);
|
||||||
final String[] colorTitles = res.getStringArray(R.array.captioning_color_selector_titles);
|
final String[] colorTitles = res.getStringArray(R.array.captioning_color_selector_titles);
|
||||||
mForegroundColor = (ColorPreference) findPreference("captioning_foreground_color");
|
mForegroundColor = (ColorPreference) mCustom.findPreference("captioning_foreground_color");
|
||||||
mForegroundColor.setTitles(colorTitles);
|
mForegroundColor.setTitles(colorTitles);
|
||||||
mForegroundColor.setValues(colorValues);
|
mForegroundColor.setValues(colorValues);
|
||||||
mEdgeColor = (ColorPreference) findPreference("captioning_edge_color");
|
mEdgeColor = (ColorPreference) mCustom.findPreference("captioning_edge_color");
|
||||||
mEdgeColor.setTitles(colorTitles);
|
mEdgeColor.setTitles(colorTitles);
|
||||||
mEdgeColor.setValues(colorValues);
|
mEdgeColor.setValues(colorValues);
|
||||||
|
|
||||||
final int[] bgColorValues = res.getIntArray(
|
// Add "none" as an additional option for backgrounds.
|
||||||
R.array.captioning_background_color_selector_values);
|
final int[] bgColorValues = new int[colorValues.length + 1];
|
||||||
final String[] bgColorTitles = res.getStringArray(
|
final String[] bgColorTitles = new String[colorTitles.length + 1];
|
||||||
R.array.captioning_background_color_selector_titles);
|
System.arraycopy(colorValues, 0, bgColorValues, 1, colorValues.length);
|
||||||
mBackgroundColor = (ColorPreference) findPreference("captioning_background_color");
|
System.arraycopy(colorTitles, 0, bgColorTitles, 1, colorTitles.length);
|
||||||
|
bgColorValues[0] = Color.TRANSPARENT;
|
||||||
|
bgColorTitles[0] = getString(R.string.color_none);
|
||||||
|
mBackgroundColor = (ColorPreference) mCustom.findPreference("captioning_background_color");
|
||||||
mBackgroundColor.setTitles(bgColorTitles);
|
mBackgroundColor.setTitles(bgColorTitles);
|
||||||
mBackgroundColor.setValues(bgColorValues);
|
mBackgroundColor.setValues(bgColorValues);
|
||||||
|
|
||||||
final int[] opacityValues = res.getIntArray(R.array.captioning_opacity_selector_values);
|
final int[] opacityValues = res.getIntArray(R.array.captioning_opacity_selector_values);
|
||||||
final String[] opacityTitles = res.getStringArray(
|
final String[] opacityTitles = res.getStringArray(
|
||||||
R.array.captioning_opacity_selector_titles);
|
R.array.captioning_opacity_selector_titles);
|
||||||
mBackgroundOpacity = (ColorPreference) findPreference("captioning_background_opacity");
|
mBackgroundOpacity = (ColorPreference) mCustom.findPreference(
|
||||||
|
"captioning_background_opacity");
|
||||||
mBackgroundOpacity.setTitles(opacityTitles);
|
mBackgroundOpacity.setTitles(opacityTitles);
|
||||||
mBackgroundOpacity.setValues(opacityValues);
|
mBackgroundOpacity.setValues(opacityValues);
|
||||||
|
|
||||||
mEdgeType = (EdgeTypePreference) findPreference("captioning_edge_type");
|
mEdgeType = (EdgeTypePreference) mCustom.findPreference("captioning_edge_type");
|
||||||
mTypeface = (ListPreference) findPreference("captioning_typeface");
|
mTypeface = (ListPreference) mCustom.findPreference("captioning_typeface");
|
||||||
mFontSize = (ListPreference) findPreference("captioning_font_size");
|
|
||||||
mLocale = (LocalePreference) findPreference("captioning_locale");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void installUpdateListeners() {
|
private void installUpdateListeners() {
|
||||||
@@ -159,6 +172,17 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void refreshShowingCustom() {
|
||||||
|
final boolean customPreset = mPreset.getValue() == CaptionStyle.PRESET_CUSTOM;
|
||||||
|
if (!customPreset && mShowingCustom) {
|
||||||
|
getPreferenceScreen().removePreference(mCustom);
|
||||||
|
mShowingCustom = false;
|
||||||
|
} else if (customPreset && !mShowingCustom) {
|
||||||
|
getPreferenceScreen().addPreference(mCustom);
|
||||||
|
mShowingCustom = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueChanged(ListDialogPreference preference, int value) {
|
public void onValueChanged(ListDialogPreference preference, int value) {
|
||||||
final ContentResolver cr = getActivity().getContentResolver();
|
final ContentResolver cr = getActivity().getContentResolver();
|
||||||
@@ -180,6 +204,7 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
|||||||
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_EDGE_COLOR, value);
|
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_EDGE_COLOR, value);
|
||||||
} else if (mPreset == preference) {
|
} else if (mPreset == preference) {
|
||||||
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_PRESET, value);
|
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_PRESET, value);
|
||||||
|
refreshShowingCustom();
|
||||||
} else if (mEdgeType == preference) {
|
} else if (mEdgeType == preference) {
|
||||||
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_EDGE_TYPE, value);
|
Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_EDGE_TYPE, value);
|
||||||
}
|
}
|
||||||
|
@@ -63,6 +63,21 @@ public class ColorPreference extends ListDialogPreference {
|
|||||||
return getValue() == Color.TRANSPARENT || super.shouldDisableDependents();
|
return getValue() == Color.TRANSPARENT || super.shouldDisableDependents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CharSequence getTitleAt(int index) {
|
||||||
|
final CharSequence title = super.getTitleAt(index);
|
||||||
|
if (title != null) {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no title was supplied, format title using RGB values.
|
||||||
|
final int value = getValueAt(index);
|
||||||
|
final int r = Color.red(value);
|
||||||
|
final int g = Color.green(value);
|
||||||
|
final int b = Color.blue(value);
|
||||||
|
return getContext().getString(R.string.color_custom, r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onBindView(View view) {
|
protected void onBindView(View view) {
|
||||||
super.onBindView(view);
|
super.onBindView(view);
|
||||||
|
Reference in New Issue
Block a user