OSDN Git Service

Update string for work mode toggle
authorTony Mak <tonymak@google.com>
Tue, 9 Jan 2018 17:36:36 +0000 (17:36 +0000)
committerTony Mak <tonymak@google.com>
Tue, 23 Jan 2018 18:12:04 +0000 (18:12 +0000)
Bug: 71743500

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

Change-Id: I8b634314c752c6ab8f51e1472db3956194390cbd

res/values/strings.xml
res/xml/managed_profile_settings.xml
src/com/android/settings/accounts/ManagedProfileSettings.java

index 9e113c3..d8625a9 100644 (file)
     <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] -->
index 58fcd88..c283e13 100644 (file)
 
     <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>
\ No newline at end of file
index 3ea7cf7..0933042 100644 (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;
             }