Update language to comply with Android's inclusive language guidance

See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: robotest & manual

Change-Id: I32f369a608c8b4f513f2c32afca6d408ee273428
This commit is contained in:
Edgar Wang
2020-08-06 15:17:22 +08:00
parent 232aaec569
commit 8c8a2e85ec
10 changed files with 47 additions and 65 deletions

View File

@@ -87,7 +87,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/left_text" android:id="@+id/left_text"
android:text="@string/accessibility_toggle_master_balance_left_label" android:text="@string/accessibility_toggle_primary_balance_left_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@@ -95,7 +95,7 @@
android:textAlignment="viewStart" /> android:textAlignment="viewStart" />
<TextView <TextView
android:id="@+id/right_text" android:id="@+id/right_text"
android:text="@string/accessibility_toggle_master_balance_right_label" android:text="@string/accessibility_toggle_primary_balance_right_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Layout used by CheckBoxPreference for the checkbox style. This is inflated
inside android.R.layout.preference. -->
<RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@null"
android:focusable="false"
android:clickable="false" />

View File

@@ -666,8 +666,8 @@
<string name="Accounts_settings_title">Accounts</string> <string name="Accounts_settings_title">Accounts</string>
<!-- Main Settings screen setting option title for the item to take you to the location screen --> <!-- Main Settings screen setting option title for the item to take you to the location screen -->
<string name="location_settings_title">Location</string> <string name="location_settings_title">Location</string>
<!-- Used in the location settings to control turning on/off the feature entirely --> <!-- Used in the location settings to control turning on/off the feature entirely [CHAR LIMIT=60] -->
<string name="location_settings_master_switch_title">Use location</string> <string name="location_settings_primary_switch_title">Use location</string>
<!-- Summary for Location settings when location is off [CHAR LIMIT=NONE] --> <!-- Summary for Location settings when location is off [CHAR LIMIT=NONE] -->
<string name="location_settings_summary_location_off">Off</string> <string name="location_settings_summary_location_off">Off</string>
<!-- Summary for Location settings when location is on, explaining how many apps have location permission [CHAR LIMIT=NONE]--> <!-- Summary for Location settings when location is on, explaining how many apps have location permission [CHAR LIMIT=NONE]-->
@@ -5045,12 +5045,12 @@
<string name="accessibility_toggle_primary_mono_title">Mono audio</string> <string name="accessibility_toggle_primary_mono_title">Mono audio</string>
<!-- Summary for the accessibility preference for primary mono. [CHAR LIMIT=50] --> <!-- Summary for the accessibility preference for primary mono. [CHAR LIMIT=50] -->
<string name="accessibility_toggle_primary_mono_summary">Combine channels when playing audio</string> <string name="accessibility_toggle_primary_mono_summary">Combine channels when playing audio</string>
<!-- Title for the accessibility preference for master balance. [CHAR LIMIT=35] --> <!-- Title for the accessibility preference for primary balance. [CHAR LIMIT=35] -->
<string name="accessibility_toggle_primary_balance_title">Audio balance</string> <string name="accessibility_toggle_primary_balance_title">Audio balance</string>
<!-- 'Left' balance text for the accessibility preference for master balance. [CHAR LIMIT=20] --> <!-- 'Left' balance text for the accessibility preference for primary balance. [CHAR LIMIT=20] -->
<string name="accessibility_toggle_master_balance_left_label">Left</string> <string name="accessibility_toggle_primary_balance_left_label">Left</string>
<!-- 'Right' balance text for the accessibility preference for master balance. [CHAR LIMIT=20] --> <!-- 'Right' balance text for the accessibility preference for primary balance. [CHAR LIMIT=20] -->
<string name="accessibility_toggle_master_balance_right_label">Right</string> <string name="accessibility_toggle_primary_balance_right_label">Right</string>
<!-- Option heading to leave the timeout requirement for accessibility users at its default level. [CHAR LIMIT=35] --> <!-- Option heading to leave the timeout requirement for accessibility users at its default level. [CHAR LIMIT=35] -->
<string name="accessibility_timeout_default">Default</string> <string name="accessibility_timeout_default">Default</string>
@@ -10579,8 +10579,8 @@
<!-- [CHAR LIMIT=30] Title for dialog for setting to control the default spell checker --> <!-- [CHAR LIMIT=30] Title for dialog for setting to control the default spell checker -->
<string name="choose_spell_checker">Choose spell checker</string> <string name="choose_spell_checker">Choose spell checker</string>
<!-- [CHAR LIMIT=45] Title for the master switch for spell checker, turning off will disable entire spell check feature. --> <!-- [CHAR LIMIT=45] Title for the primary switch for spell checker, turning off will disable entire spell check feature. -->
<string name="spell_checker_master_switch_title">Use spell checker</string> <string name="spell_checker_primary_switch_title">Use spell checker</string>
<!-- [CHAR LIMIT=30] Label for the placeholder of the current spell checker name. Used when no spell checker is currently selected. --> <!-- [CHAR LIMIT=30] Label for the placeholder of the current spell checker name. Used when no spell checker is currently selected. -->
<string name="spell_checker_not_selected">Not selected</string> <string name="spell_checker_not_selected">Not selected</string>
@@ -10793,8 +10793,8 @@
<!-- Preference title for the automatic storage manager toggle. [CHAR LIMIT=60]--> <!-- Preference title for the automatic storage manager toggle. [CHAR LIMIT=60]-->
<string name="automatic_storage_manager_preference_title">Storage manager</string> <string name="automatic_storage_manager_preference_title">Storage manager</string>
<!-- Used in the storage manager settings screen to control turning on/off the feature entirely --> <!-- Used in the storage manager settings screen to control turning on/off the feature entirely [CHAR LIMIT=60] -->
<string name="automatic_storage_manager_master_switch_title">Use Storage manager</string> <string name="automatic_storage_manager_primary_switch_title">Use Storage manager</string>
<!-- Category title for the automatic settings in the storage manager settings. [CHAR LIMIT=40] --> <!-- Category title for the automatic settings in the storage manager settings. [CHAR LIMIT=40] -->
<string name="deletion_helper_automatic_title">Automatic</string> <string name="deletion_helper_automatic_title">Automatic</string>

View File

@@ -37,8 +37,8 @@ public class ProfileSelectLocationFragment extends ProfileSelectFragment {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
final SettingsActivity activity = (SettingsActivity) getActivity(); final SettingsActivity activity = (SettingsActivity) getActivity();
final SwitchBar switchBar = activity.getSwitchBar(); final SwitchBar switchBar = activity.getSwitchBar();
switchBar.setSwitchBarText(R.string.location_settings_master_switch_title, switchBar.setSwitchBarText(R.string.location_settings_primary_switch_title,
R.string.location_settings_master_switch_title); R.string.location_settings_primary_switch_title);
final LocationSwitchBarController switchBarController = new LocationSwitchBarController( final LocationSwitchBarController switchBarController = new LocationSwitchBarController(
activity, switchBar, getSettingsLifecycle()); activity, switchBar, getSettingsLifecycle());
switchBar.show(); switchBar.show();

View File

@@ -83,8 +83,8 @@ public class AutomaticStorageManagerSettings extends DashboardFragment
private void initializeSwitchBar() { private void initializeSwitchBar() {
final SettingsActivity activity = (SettingsActivity) getActivity(); final SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar(); mSwitchBar = activity.getSwitchBar();
mSwitchBar.setSwitchBarText(R.string.automatic_storage_manager_master_switch_title, mSwitchBar.setSwitchBarText(R.string.automatic_storage_manager_primary_switch_title,
R.string.automatic_storage_manager_master_switch_title); R.string.automatic_storage_manager_primary_switch_title);
mSwitchBar.show(); mSwitchBar.show();
mSwitchController = mSwitchController =
new AutomaticStorageManagerSwitchBarController( new AutomaticStorageManagerSwitchBarController(

View File

@@ -93,8 +93,8 @@ public class SpellCheckersSettings extends SettingsPreferenceFragment
super.onResume(); super.onResume();
mSwitchBar = ((SettingsActivity) getActivity()).getSwitchBar(); mSwitchBar = ((SettingsActivity) getActivity()).getSwitchBar();
mSwitchBar.setSwitchBarText( mSwitchBar.setSwitchBarText(
R.string.spell_checker_master_switch_title, R.string.spell_checker_primary_switch_title,
R.string.spell_checker_master_switch_title); R.string.spell_checker_primary_switch_title);
mSwitchBar.show(); mSwitchBar.show();
mSwitchBar.addOnSwitchChangeListener(this); mSwitchBar.addOnSwitchChangeListener(this);
updatePreferenceScreen(); updatePreferenceScreen();

View File

@@ -71,8 +71,8 @@ public class LocationSettings extends DashboardFragment {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
final SettingsActivity activity = (SettingsActivity) getActivity(); final SettingsActivity activity = (SettingsActivity) getActivity();
final SwitchBar switchBar = activity.getSwitchBar(); final SwitchBar switchBar = activity.getSwitchBar();
switchBar.setSwitchBarText(R.string.location_settings_master_switch_title, switchBar.setSwitchBarText(R.string.location_settings_primary_switch_title,
R.string.location_settings_master_switch_title); R.string.location_settings_primary_switch_title);
mSwitchBarController = new LocationSwitchBarController(activity, switchBar, mSwitchBarController = new LocationSwitchBarController(activity, switchBar,
getSettingsLifecycle()); getSettingsLifecycle());
switchBar.show(); switchBar.show();

View File

@@ -31,32 +31,32 @@ import com.android.settingslib.TwoTargetPreference;
* A custom preference that provides inline checkbox. It has a mandatory field for title, and * A custom preference that provides inline checkbox. It has a mandatory field for title, and
* optional fields for icon and sub-text. * optional fields for icon and sub-text.
*/ */
public class MasterCheckBoxPreference extends TwoTargetPreference { public class PrimaryCheckBoxPreference extends TwoTargetPreference {
private CheckBox mCheckBox; private CheckBox mCheckBox;
private boolean mChecked; private boolean mChecked;
private boolean mEnableCheckBox = true; private boolean mEnableCheckBox = true;
public MasterCheckBoxPreference(Context context, AttributeSet attrs, public PrimaryCheckBoxPreference(Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) { int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);
} }
public MasterCheckBoxPreference(Context context, AttributeSet attrs, int defStyleAttr) { public PrimaryCheckBoxPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
public MasterCheckBoxPreference(Context context, AttributeSet attrs) { public PrimaryCheckBoxPreference(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
} }
public MasterCheckBoxPreference(Context context) { public PrimaryCheckBoxPreference(Context context) {
super(context); super(context);
} }
@Override @Override
protected int getSecondTargetResId() { protected int getSecondTargetResId() {
return R.layout.preference_widget_master_checkbox; return R.layout.preference_widget_primary_checkbox;
} }
@Override @Override
@@ -98,6 +98,10 @@ public class MasterCheckBoxPreference extends TwoTargetPreference {
return mCheckBox != null && mChecked; return mCheckBox != null && mChecked;
} }
/**
* Set the check status of checkbox
* @param checked
*/
public void setChecked(boolean checked) { public void setChecked(boolean checked) {
mChecked = checked; mChecked = checked;
if (mCheckBox != null) { if (mCheckBox != null) {
@@ -105,6 +109,10 @@ public class MasterCheckBoxPreference extends TwoTargetPreference {
} }
} }
/**
* Set the enabled status of CheckBox
* @param enabled
*/
public void setCheckBoxEnabled(boolean enabled) { public void setCheckBoxEnabled(boolean enabled) {
mEnableCheckBox = enabled; mEnableCheckBox = enabled;
if (mCheckBox != null) { if (mCheckBox != null) {

View File

@@ -39,28 +39,28 @@ import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment; import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class) @RunWith(RobolectricTestRunner.class)
public class MasterCheckBoxPreferenceTest { public class PrimaryCheckBoxPreferenceTest {
private Context mContext; private Context mContext;
private MasterCheckBoxPreference mPreference; private PrimaryCheckBoxPreference mPreference;
@Before @Before
public void setUp() { public void setUp() {
mContext = RuntimeEnvironment.application; mContext = RuntimeEnvironment.application;
mPreference = new MasterCheckBoxPreference(mContext); mPreference = new PrimaryCheckBoxPreference(mContext);
} }
@Test @Test
public void createNewPreference_shouldSetLayout() { public void createNewPreference_shouldSetLayout() {
assertThat(mPreference.getWidgetLayoutResource()) assertThat(mPreference.getWidgetLayoutResource())
.isEqualTo(R.layout.preference_widget_master_checkbox); .isEqualTo(R.layout.preference_widget_primary_checkbox);
} }
@Test @Test
public void setChecked_shouldUpdateCheckBoxCheckedState() { public void setChecked_shouldUpdateCheckBoxCheckedState() {
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests( final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
LayoutInflater.from(mContext).inflate( LayoutInflater.from(mContext).inflate(
R.layout.preference_widget_master_checkbox, null)); R.layout.preference_widget_primary_checkbox, null));
final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget); final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget);
mPreference.onBindViewHolder(holder); mPreference.onBindViewHolder(holder);
@@ -75,7 +75,7 @@ public class MasterCheckBoxPreferenceTest {
public void setEnabled_shouldUpdateCheckBoxEnabledState() { public void setEnabled_shouldUpdateCheckBoxEnabledState() {
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests( final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
LayoutInflater.from(mContext).inflate( LayoutInflater.from(mContext).inflate(
R.layout.preference_widget_master_checkbox, null)); R.layout.preference_widget_primary_checkbox, null));
final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget); final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget);
mPreference.onBindViewHolder(holder); mPreference.onBindViewHolder(holder);
@@ -90,7 +90,7 @@ public class MasterCheckBoxPreferenceTest {
public void setCheckboxEnabled_shouldOnlyUpdateCheckBoxEnabledState() { public void setCheckboxEnabled_shouldOnlyUpdateCheckBoxEnabledState() {
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests( final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
LayoutInflater.from(mContext).inflate( LayoutInflater.from(mContext).inflate(
R.layout.preference_widget_master_checkbox, null)); R.layout.preference_widget_primary_checkbox, null));
final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget); final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget);
mPreference.onBindViewHolder(holder); mPreference.onBindViewHolder(holder);
@@ -107,7 +107,7 @@ public class MasterCheckBoxPreferenceTest {
public void onBindViewHolder_shouldSetCheckboxEnabledState() { public void onBindViewHolder_shouldSetCheckboxEnabledState() {
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests( final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
LayoutInflater.from(mContext).inflate( LayoutInflater.from(mContext).inflate(
R.layout.preference_widget_master_checkbox, null)); R.layout.preference_widget_primary_checkbox, null));
final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget); final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget);
mPreference.setCheckBoxEnabled(false); mPreference.setCheckBoxEnabled(false);
@@ -129,7 +129,7 @@ public class MasterCheckBoxPreferenceTest {
final LinearLayout widgetView = holder.itemView.findViewById(android.R.id.widget_frame); final LinearLayout widgetView = holder.itemView.findViewById(android.R.id.widget_frame);
assertThat(widgetView).isNotNull(); assertThat(widgetView).isNotNull();
inflater.inflate(R.layout.preference_widget_master_checkbox, widgetView, true); inflater.inflate(R.layout.preference_widget_primary_checkbox, widgetView, true);
final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget); final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget);
mPreference.onBindViewHolder(holder); mPreference.onBindViewHolder(holder);
@@ -148,7 +148,7 @@ public class MasterCheckBoxPreferenceTest {
final LinearLayout widgetView = holder.itemView.findViewById(android.R.id.widget_frame); final LinearLayout widgetView = holder.itemView.findViewById(android.R.id.widget_frame);
assertThat(widgetView).isNotNull(); assertThat(widgetView).isNotNull();
inflater.inflate(R.layout.preference_widget_master_checkbox, widgetView, true); inflater.inflate(R.layout.preference_widget_primary_checkbox, widgetView, true);
final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget); final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget);
mPreference.onBindViewHolder(holder); mPreference.onBindViewHolder(holder);
mPreference.setEnabled(false); mPreference.setEnabled(false);
@@ -178,8 +178,8 @@ public class MasterCheckBoxPreferenceTest {
@Test @Test
public void onBindViewHolder_checkBoxShouldHaveContentDescription() { public void onBindViewHolder_checkBoxShouldHaveContentDescription() {
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests( final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
LayoutInflater.from(mContext) LayoutInflater.from(mContext).inflate(R.layout.preference_widget_primary_checkbox,
.inflate(R.layout.preference_widget_master_checkbox, null)); null));
final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget); final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget);
final String label = "TestButton"; final String label = "TestButton";
mPreference.setTitle(label); mPreference.setTitle(label);