Polish humanize strings for Caption preferences page
- Add intro for usage - Update footer description on limitations - Update the default caption size to medium - Update the caption size and style dynamically Bug: 218409087 Test: make RunSettingsRoboTests ROBOTEST_FILTER=CaptionAppearancePreferenceControllerTest Change-Id: I6526250894cc6a3fd02e3d8c675280855b307a68
This commit is contained in:
@@ -34,8 +34,6 @@ import com.android.settings.widget.SettingsMainSwitchPreference;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
import com.android.settingslib.widget.OnMainSwitchChangeListener;
|
||||
|
||||
import com.google.common.primitives.Floats;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -56,7 +54,6 @@ public class CaptionPropertiesFragment extends DashboardFragment
|
||||
private Preference mMoreOptions;
|
||||
|
||||
private final List<Preference> mPreferenceList = new ArrayList<>();
|
||||
private float[] mFontSizeValuesArray;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -71,13 +68,12 @@ public class CaptionPropertiesFragment extends DashboardFragment
|
||||
|
||||
initializeAllPreferences();
|
||||
installUpdateListeners();
|
||||
initFontSizeValuesArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateAllPreferences();
|
||||
mSwitch.setChecked(mCaptioningManager.isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,21 +101,6 @@ public class CaptionPropertiesFragment extends DashboardFragment
|
||||
|
||||
}
|
||||
|
||||
private void initFontSizeValuesArray() {
|
||||
final String[] fontSizeValuesStrArray = getPrefContext().getResources().getStringArray(
|
||||
R.array.captioning_font_size_selector_values);
|
||||
final int length = fontSizeValuesStrArray.length;
|
||||
mFontSizeValuesArray = new float[length];
|
||||
for (int i = 0; i < length; ++i) {
|
||||
mFontSizeValuesArray[i] = Float.parseFloat(fontSizeValuesStrArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAllPreferences() {
|
||||
mSwitch.setChecked(mCaptioningManager.isEnabled());
|
||||
mTextAppearance.setSummary(geTextAppearanceSummary(getPrefContext()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object value) {
|
||||
final ContentResolver cr = getActivity().getContentResolver();
|
||||
@@ -136,16 +117,6 @@ public class CaptionPropertiesFragment extends DashboardFragment
|
||||
return R.string.help_url_caption;
|
||||
}
|
||||
|
||||
private CharSequence geTextAppearanceSummary(Context context) {
|
||||
final String[] fontSizeSummaries = context.getResources().getStringArray(
|
||||
R.array.captioning_font_size_selector_summaries);
|
||||
|
||||
final float fontSize = mCaptioningManager.getFontScale();
|
||||
final int idx = Floats.indexOf(mFontSizeValuesArray, fontSize);
|
||||
|
||||
return fontSizeSummaries[idx == /* not exist */ -1 ? 0 : idx];
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.captioning_settings);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user