Talkback improvements for Settings screens.

Bug: 21164141
Change-Id: I7444261ccf967f6db70c9fe44a00bd3f19ceb975
This commit is contained in:
Julia Reynolds
2015-07-08 16:56:31 -04:00
parent 64e1e15d10
commit ce25af4838
12 changed files with 139 additions and 3 deletions

View File

@@ -49,6 +49,7 @@ import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.AccessiblePreferenceCategory;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
@@ -270,14 +271,19 @@ public class AccountSettings extends SettingsPreferenceFragment
final ProfileData profileData = new ProfileData();
profileData.userInfo = userInfo;
if (addCategory) {
profileData.preferenceGroup = new PreferenceCategory(context);
profileData.preferenceGroup = new AccessiblePreferenceCategory(context);
if (userInfo.isManagedProfile()) {
profileData.preferenceGroup.setLayoutResource(R.layout.work_profile_category);
profileData.preferenceGroup.setTitle(R.string.category_work);
profileData.preferenceGroup.setSummary(getWorkGroupSummary(context, userInfo));
String workGroupSummary = getWorkGroupSummary(context, userInfo);
profileData.preferenceGroup.setSummary(workGroupSummary);
((AccessiblePreferenceCategory) profileData.preferenceGroup).setContentDescription(
getString(R.string.accessibility_category_work, workGroupSummary));
profileData.removeWorkProfilePreference = newRemoveWorkProfilePreference(context);
} else {
profileData.preferenceGroup.setTitle(R.string.category_personal);
((AccessiblePreferenceCategory) profileData.preferenceGroup).setContentDescription(
getString(R.string.accessibility_category_personal));
}
parent.addPreference(profileData.preferenceGroup);
} else {

View File

@@ -35,6 +35,7 @@ import android.content.SyncAdapterType;
import android.content.SyncInfo;
import android.content.SyncStatusInfo;
import android.content.pm.ProviderInfo;
import android.content.pm.UserInfo;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
@@ -151,6 +152,7 @@ public class AccountSyncSettings extends AccountPreferenceBase {
super.onCreate(icicle);
setPreferenceScreen(null);
addPreferencesFromResource(R.xml.account_sync_settings);
setAccessibilityTitle();
setHasOptionsMenu(true);
}
@@ -200,6 +202,18 @@ public class AccountSyncSettings extends AccountPreferenceBase {
mProviderId.setText(mAccount.type);
}
private void setAccessibilityTitle() {
final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
UserInfo user = um.getUserInfo(mUserHandle.getIdentifier());
boolean isWorkProfile = user != null ? user.isManagedProfile() : false;
CharSequence currentTitle = getActivity().getTitle();
String accessibilityTitle =
getString(isWorkProfile
? R.string.accessibility_work_account_title
: R.string.accessibility_personal_account_title, currentTitle);
getActivity().setTitle(Utils.createAccessibleSequence(currentTitle, accessibilityTitle));
}
@Override
public void onResume() {
removePreference("dummy");