Update string for work mode toggle

Bug: 71743500

Test: Go to that page in settings, observe the string.
Test: Flip the state, observe the summary is updated.

Change-Id: I8b634314c752c6ab8f51e1472db3956194390cbd
This commit is contained in:
Tony Mak
2018-01-09 17:36:36 +00:00
parent fa432af9f4
commit a0aebabdc4
3 changed files with 19 additions and 12 deletions

View File

@@ -5580,10 +5580,12 @@
<string name="add_account_label">Add account</string>
<!-- Label for the state of the work profile [CHAR LIMIT=80] -->
<string name="managed_profile_not_available_label">Work profile isn\u2019t available yet</string>
<!-- Account Settings. The preference title for enabling work mode -->
<string name="work_mode_label">Work mode</string>
<!-- Account Settings. The preference summary for enabling work mode -->
<string name="work_mode_summary">Allow work profile to function, including apps, background sync, and related features</string>
<!-- This string is the title of a setting. If a user taps the setting, they can turn their work profile on or off. The work profile is a section of their phone that's managed by their employer. "Work" is an adjective. -->
<string name="work_mode_label">Work profile</string>
<!-- This string is located under a setting and describes what the setting does. It's letting a user know whether their work profile is on or off, and they can use the setting to turn it on or off. The work profile is a section of their phone that's managed by their employer. "Work" is an adjective.-->
<string name="work_mode_on_summary">Managed by your organization</string>
<!-- This string is located under a setting and describes what the setting does. It's letting a user know whether their work profile is on or off, and they can use the setting to turn it on or off. The work profile is a section of their phone that's managed by their employer. "Work" is an adjective.-->
<string name="work_mode_off_summary">Apps and notifications are off</string>
<!-- Button label to remove the work profile [CHAR LIMIT=35] -->
<string name="remove_managed_profile_label">Remove work profile</string>
<!-- Data synchronization settings screen, title of setting that controls whether background data should be used [CHAR LIMIT=30] -->

View File

@@ -20,14 +20,13 @@
<SwitchPreference
android:key="work_mode"
android:summary="@string/work_mode_summary"
android:title="@string/work_mode_label"/>
android:title="@string/work_mode_label"
android:summary="@string/summary_placeholder"/>
<com.android.settingslib.RestrictedSwitchPreference
android:key="contacts_search"
android:summary="@string/managed_profile_contact_search_summary"
android:title="@string/managed_profile_contact_search_title"
settings:useAdditionalSummary="true"
/>
settings:useAdditionalSummary="true"/>
</PreferenceScreen>

View File

@@ -104,8 +104,7 @@ public class ManagedProfileSettings extends SettingsPreferenceFragment
private void loadDataAndPopulateUi() {
if (mWorkModePreference != null) {
mWorkModePreference.setChecked(
!mUserManager.isQuietModeEnabled(mManagedUser));
updateWorkModePreference();
}
if (mContactPrefrence != null) {
@@ -124,6 +123,14 @@ public class ManagedProfileSettings extends SettingsPreferenceFragment
return MetricsProto.MetricsEvent.ACCOUNTS_WORK_PROFILE_SETTINGS;
}
private void updateWorkModePreference() {
boolean isWorkModeOn = !mUserManager.isQuietModeEnabled(mManagedUser);
mWorkModePreference.setChecked(isWorkModeOn);
mWorkModePreference.setSummary(isWorkModeOn
? R.string.work_mode_on_summary
: R.string.work_mode_off_summary);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
@@ -159,8 +166,7 @@ public class ManagedProfileSettings extends SettingsPreferenceFragment
|| action.equals(Intent.ACTION_MANAGED_PROFILE_UNAVAILABLE)) {
if (intent.getIntExtra(Intent.EXTRA_USER_HANDLE,
UserHandle.USER_NULL) == mManagedUser.getIdentifier()) {
mWorkModePreference.setChecked(
!mUserManager.isQuietModeEnabled(mManagedUser));
updateWorkModePreference();
}
return;
}