Loading res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -7975,6 +7975,8 @@ <string name="auto_sync_personal_account_title">Auto sync personal account data</string> <!-- Switch label to enable auto sync work account [CHAR LIMIT=60] --> <string name="auto_sync_work_account_title">Auto sync work account data</string> <!-- Preference label to sync account [CHAR LIMIT=60] --> <string name="account_sync_title">Account sync</string> <!-- Enterprise Privacy --> <skip /> res/xml/account_type_settings.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 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. --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" android:title="@string/account_settings_title" settings:keywords="@string/keywords_accounts"> <Preference android:key="account_sync" android:title="@string/account_sync_title" android:order="1"/> <PreferenceCategory android:key="dashboard_tile_placeholder" android:order="10"/> </PreferenceScreen> res/xml/user_and_accounts_settings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -52,4 +52,8 @@ settings:useAdditionalSummary="true" android:order="105"/> <PreferenceCategory android:key="dashboard_tile_placeholder" android:order="200"/> </PreferenceScreen> src/com/android/settings/accounts/AccountDetailDashboardFragment.java 0 → 100644 +123 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 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. */ package com.android.settings.accounts; import android.accounts.Account; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.support.annotation.VisibleForTesting; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.settings.R; import com.android.settings.Utils; import com.android.settings.core.PreferenceController; import com.android.settings.dashboard.DashboardFragment; import com.android.settingslib.drawer.CategoryKey; import com.android.settingslib.drawer.Tile; import java.util.ArrayList; import java.util.List; public class AccountDetailDashboardFragment extends DashboardFragment { private static final String TAG = "AccountDetailDashboard"; private static final String METADATA_IA_ACCOUNT = "com.android.settings.ia.account"; public static final String KEY_ACCOUNT = "account"; public static final String KEY_ACCOUNT_TYPE = "account_type"; public static final String KEY_ACCOUNT_LABEL = "account_label"; public static final String KEY_ACCOUNT_TITLE_RES = "account_title_res"; private String mAccountLabel; @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) String mAccountType; private AccountSyncPreferenceController mAccountSynController; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Bundle args = getArguments(); final Activity activity = getActivity(); UserHandle userHandle = Utils.getSecureTargetUser(activity.getActivityToken(), (UserManager) getSystemService(Context.USER_SERVICE), args, activity.getIntent().getExtras()); Account account = null; if (args != null) { if (args.containsKey(KEY_ACCOUNT)) { account = args.getParcelable(KEY_ACCOUNT); } if (args.containsKey(KEY_ACCOUNT_LABEL)) { mAccountLabel = args.getString(KEY_ACCOUNT_LABEL); } if (args.containsKey(KEY_ACCOUNT_TYPE)) { mAccountType = args.getString(KEY_ACCOUNT_TYPE); } } mAccountSynController.init(account, userHandle); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (mAccountLabel != null) { getActivity().setTitle(mAccountLabel); } } @Override public int getMetricsCategory() { return MetricsEvent.ACCOUNT; } @Override protected String getCategoryKey() { return CategoryKey.CATEGORY_ACCOUNT; } @Override protected String getLogTag() { return TAG; } @Override protected int getPreferenceScreenResId() { return R.xml.account_type_settings; } @Override protected List<PreferenceController> getPreferenceControllers(Context context) { final List<PreferenceController> controllers = new ArrayList<>(); mAccountSynController = new AccountSyncPreferenceController(context); controllers.add(mAccountSynController); return controllers; } @Override protected boolean displayTile(Tile tile) { if (mAccountType == null) { return false; } final Bundle metadata = tile.metaData; if (metadata == null) { return false; } return mAccountType.equals(metadata.getString(METADATA_IA_ACCOUNT)); } } No newline at end of file src/com/android/settings/accounts/AccountPreferenceController.java +56 −24 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.UserInfo; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; Loading @@ -47,6 +48,7 @@ import com.android.settings.core.PreferenceController; import com.android.settings.core.lifecycle.LifecycleObserver; import com.android.settings.core.lifecycle.events.OnPause; import com.android.settings.core.lifecycle.events.OnResume; import com.android.settings.dashboard.DashboardFeatureProvider; import com.android.settings.overlay.FeatureFactory; import com.android.settings.search.Index; import com.android.settings.search.SearchIndexableRaw; Loading Loading @@ -86,6 +88,7 @@ public class AccountPreferenceController extends PreferenceController private boolean mIAEnabled; private int mAccountProfileOrder = ORDER_ACCOUNT_PROFILES; private AccountRestrictionHelper mHelper; private DashboardFeatureProvider mDashboardFeatureProvider; /** * Holds data related to the accounts belonging to one profile. Loading Loading @@ -132,8 +135,9 @@ public class AccountPreferenceController extends PreferenceController if (mAuthorities != null) { mAuthoritiesCount = mAuthorities.length; } mIAEnabled = FeatureFactory.getFactory(mContext).getDashboardFeatureProvider(mContext) .isEnabled(); mDashboardFeatureProvider = FeatureFactory.getFactory(mContext).getDashboardFeatureProvider(mContext); mIAEnabled = mDashboardFeatureProvider.isEnabled(); mHelper = helper; } Loading Loading @@ -250,11 +254,6 @@ public class AccountPreferenceController extends PreferenceController } private void updateUi() { if (!mIAEnabled) { // Load the preferences from an XML resource mParent.addPreferencesFromResource(R.xml.account_settings); } if (!isAvailable()) { // This should not happen Log.e(TAG, "We should not be showing settings for a managed profile"); Loading @@ -264,6 +263,11 @@ public class AccountPreferenceController extends PreferenceController return; } if (!mIAEnabled) { // Load the preferences from an XML resource mParent.addPreferencesFromResource(R.xml.account_settings); } if (mUm.isLinkedUser()) { // Restricted user or similar UserInfo userInfo = mUm.getUserInfo(UserHandle.myUserId()); Loading Loading @@ -400,7 +404,7 @@ public class AccountPreferenceController extends PreferenceController private void updateAccountTypes(ProfileData profileData) { profileData.preferenceGroup.removeAll(); if (profileData.userInfo.isEnabled()) { final ArrayList<AccountPreference> preferences = getAccountTypePreferences( final ArrayList<AccountTypePreference> preferences = getAccountTypePreferences( profileData.authenticatorHelper, profileData.userInfo.getUserHandle()); final int count = preferences.size(); for (int i = 0; i < count; i++) { Loading Loading @@ -430,11 +434,11 @@ public class AccountPreferenceController extends PreferenceController } } private ArrayList<AccountPreference> getAccountTypePreferences(AuthenticatorHelper helper, private ArrayList<AccountTypePreference> getAccountTypePreferences(AuthenticatorHelper helper, UserHandle userHandle) { final String[] accountTypes = helper.getEnabledAccountTypes(); final ArrayList<AccountPreference> accountTypePreferences = new ArrayList<AccountPreference>(accountTypes.length); final ArrayList<AccountTypePreference> accountTypePreferences = new ArrayList<AccountTypePreference>(accountTypes.length); for (int i = 0; i < accountTypes.length; i++) { final String accountType = accountTypes[i]; Loading @@ -453,17 +457,40 @@ public class AccountPreferenceController extends PreferenceController .getAccountsByTypeAsUser(accountType, userHandle); final boolean skipToAccount = accounts.length == 1 && !helper.hasAccountPreferences(accountType); if (skipToAccount) { final Drawable icon = helper.getDrawableForType(mContext, accountType); final Context prefContext = mParent.getPreferenceManager().getContext(); if (mIAEnabled) { // Add a preference row for each individual account for (Account account : accounts) { final ArrayList<String> auths = helper.getAuthoritiesForAccountType(account.type); if (!AccountRestrictionHelper.showAccount(mAuthorities, auths)) { continue; } final Bundle fragmentArguments = new Bundle(); fragmentArguments.putParcelable(AccountDetailDashboardFragment.KEY_ACCOUNT, account); fragmentArguments.putString(AccountDetailDashboardFragment.KEY_ACCOUNT_TYPE, accountType); fragmentArguments.putString(AccountDetailDashboardFragment.KEY_ACCOUNT_LABEL, label.toString()); fragmentArguments.putInt(AccountDetailDashboardFragment.KEY_ACCOUNT_TITLE_RES, titleResId); fragmentArguments.putParcelable(EXTRA_USER, userHandle); accountTypePreferences.add(new AccountTypePreference( prefContext, account.name, titleResPackageName, titleResId, label, AccountDetailDashboardFragment.class.getName(), fragmentArguments, icon)); } } else if (skipToAccount) { final Bundle fragmentArguments = new Bundle(); fragmentArguments.putParcelable(AccountSyncSettings.ACCOUNT_KEY, accounts[0]); fragmentArguments.putParcelable(EXTRA_USER, userHandle); accountTypePreferences.add(new AccountPreference( mParent.getPreferenceManager().getContext(), label, titleResPackageName, titleResId, AccountSyncSettings.class.getName(), fragmentArguments, helper.getDrawableForType(mContext, accountType))); accountTypePreferences.add(new AccountTypePreference( prefContext, label, titleResPackageName, titleResId, AccountSyncSettings.class.getName(), fragmentArguments, icon)); } else { final Bundle fragmentArguments = new Bundle(); fragmentArguments.putString(ManageAccountsSettings.KEY_ACCOUNT_TYPE, accountType); Loading @@ -471,18 +498,23 @@ public class AccountPreferenceController extends PreferenceController label.toString()); fragmentArguments.putParcelable(EXTRA_USER, userHandle); accountTypePreferences.add(new AccountPreference( mParent.getPreferenceManager().getContext(), label, titleResPackageName, titleResId, ManageAccountsSettings.class.getName(), fragmentArguments, helper.getDrawableForType(mContext, accountType))); accountTypePreferences.add(new AccountTypePreference( prefContext, label, titleResPackageName, titleResId, ManageAccountsSettings.class.getName(), fragmentArguments, icon)); } helper.preloadDrawableForType(mContext, accountType); } // Sort by label Collections.sort(accountTypePreferences, new Comparator<AccountPreference>() { Collections.sort(accountTypePreferences, new Comparator<AccountTypePreference>() { @Override public int compare(AccountPreference t1, AccountPreference t2) { return t1.getitle().toString().compareTo(t2.getitle().toString()); public int compare(AccountTypePreference t1, AccountTypePreference t2) { int result = 0; if (mIAEnabled) { result = t1.getSummary().toString().compareTo(t2.getSummary().toString()); } return result != 0 ? result : t1.getTitle().toString().compareTo(t2.getTitle().toString()); } }); return accountTypePreferences; Loading Loading
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -7975,6 +7975,8 @@ <string name="auto_sync_personal_account_title">Auto sync personal account data</string> <!-- Switch label to enable auto sync work account [CHAR LIMIT=60] --> <string name="auto_sync_work_account_title">Auto sync work account data</string> <!-- Preference label to sync account [CHAR LIMIT=60] --> <string name="account_sync_title">Account sync</string> <!-- Enterprise Privacy --> <skip />
res/xml/account_type_settings.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2016 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. --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" android:title="@string/account_settings_title" settings:keywords="@string/keywords_accounts"> <Preference android:key="account_sync" android:title="@string/account_sync_title" android:order="1"/> <PreferenceCategory android:key="dashboard_tile_placeholder" android:order="10"/> </PreferenceScreen>
res/xml/user_and_accounts_settings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -52,4 +52,8 @@ settings:useAdditionalSummary="true" android:order="105"/> <PreferenceCategory android:key="dashboard_tile_placeholder" android:order="200"/> </PreferenceScreen>
src/com/android/settings/accounts/AccountDetailDashboardFragment.java 0 → 100644 +123 −0 Original line number Diff line number Diff line /* * Copyright (C) 2016 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. */ package com.android.settings.accounts; import android.accounts.Account; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.support.annotation.VisibleForTesting; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.settings.R; import com.android.settings.Utils; import com.android.settings.core.PreferenceController; import com.android.settings.dashboard.DashboardFragment; import com.android.settingslib.drawer.CategoryKey; import com.android.settingslib.drawer.Tile; import java.util.ArrayList; import java.util.List; public class AccountDetailDashboardFragment extends DashboardFragment { private static final String TAG = "AccountDetailDashboard"; private static final String METADATA_IA_ACCOUNT = "com.android.settings.ia.account"; public static final String KEY_ACCOUNT = "account"; public static final String KEY_ACCOUNT_TYPE = "account_type"; public static final String KEY_ACCOUNT_LABEL = "account_label"; public static final String KEY_ACCOUNT_TITLE_RES = "account_title_res"; private String mAccountLabel; @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) String mAccountType; private AccountSyncPreferenceController mAccountSynController; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Bundle args = getArguments(); final Activity activity = getActivity(); UserHandle userHandle = Utils.getSecureTargetUser(activity.getActivityToken(), (UserManager) getSystemService(Context.USER_SERVICE), args, activity.getIntent().getExtras()); Account account = null; if (args != null) { if (args.containsKey(KEY_ACCOUNT)) { account = args.getParcelable(KEY_ACCOUNT); } if (args.containsKey(KEY_ACCOUNT_LABEL)) { mAccountLabel = args.getString(KEY_ACCOUNT_LABEL); } if (args.containsKey(KEY_ACCOUNT_TYPE)) { mAccountType = args.getString(KEY_ACCOUNT_TYPE); } } mAccountSynController.init(account, userHandle); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (mAccountLabel != null) { getActivity().setTitle(mAccountLabel); } } @Override public int getMetricsCategory() { return MetricsEvent.ACCOUNT; } @Override protected String getCategoryKey() { return CategoryKey.CATEGORY_ACCOUNT; } @Override protected String getLogTag() { return TAG; } @Override protected int getPreferenceScreenResId() { return R.xml.account_type_settings; } @Override protected List<PreferenceController> getPreferenceControllers(Context context) { final List<PreferenceController> controllers = new ArrayList<>(); mAccountSynController = new AccountSyncPreferenceController(context); controllers.add(mAccountSynController); return controllers; } @Override protected boolean displayTile(Tile tile) { if (mAccountType == null) { return false; } final Bundle metadata = tile.metaData; if (metadata == null) { return false; } return mAccountType.equals(metadata.getString(METADATA_IA_ACCOUNT)); } } No newline at end of file
src/com/android/settings/accounts/AccountPreferenceController.java +56 −24 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.UserInfo; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; Loading @@ -47,6 +48,7 @@ import com.android.settings.core.PreferenceController; import com.android.settings.core.lifecycle.LifecycleObserver; import com.android.settings.core.lifecycle.events.OnPause; import com.android.settings.core.lifecycle.events.OnResume; import com.android.settings.dashboard.DashboardFeatureProvider; import com.android.settings.overlay.FeatureFactory; import com.android.settings.search.Index; import com.android.settings.search.SearchIndexableRaw; Loading Loading @@ -86,6 +88,7 @@ public class AccountPreferenceController extends PreferenceController private boolean mIAEnabled; private int mAccountProfileOrder = ORDER_ACCOUNT_PROFILES; private AccountRestrictionHelper mHelper; private DashboardFeatureProvider mDashboardFeatureProvider; /** * Holds data related to the accounts belonging to one profile. Loading Loading @@ -132,8 +135,9 @@ public class AccountPreferenceController extends PreferenceController if (mAuthorities != null) { mAuthoritiesCount = mAuthorities.length; } mIAEnabled = FeatureFactory.getFactory(mContext).getDashboardFeatureProvider(mContext) .isEnabled(); mDashboardFeatureProvider = FeatureFactory.getFactory(mContext).getDashboardFeatureProvider(mContext); mIAEnabled = mDashboardFeatureProvider.isEnabled(); mHelper = helper; } Loading Loading @@ -250,11 +254,6 @@ public class AccountPreferenceController extends PreferenceController } private void updateUi() { if (!mIAEnabled) { // Load the preferences from an XML resource mParent.addPreferencesFromResource(R.xml.account_settings); } if (!isAvailable()) { // This should not happen Log.e(TAG, "We should not be showing settings for a managed profile"); Loading @@ -264,6 +263,11 @@ public class AccountPreferenceController extends PreferenceController return; } if (!mIAEnabled) { // Load the preferences from an XML resource mParent.addPreferencesFromResource(R.xml.account_settings); } if (mUm.isLinkedUser()) { // Restricted user or similar UserInfo userInfo = mUm.getUserInfo(UserHandle.myUserId()); Loading Loading @@ -400,7 +404,7 @@ public class AccountPreferenceController extends PreferenceController private void updateAccountTypes(ProfileData profileData) { profileData.preferenceGroup.removeAll(); if (profileData.userInfo.isEnabled()) { final ArrayList<AccountPreference> preferences = getAccountTypePreferences( final ArrayList<AccountTypePreference> preferences = getAccountTypePreferences( profileData.authenticatorHelper, profileData.userInfo.getUserHandle()); final int count = preferences.size(); for (int i = 0; i < count; i++) { Loading Loading @@ -430,11 +434,11 @@ public class AccountPreferenceController extends PreferenceController } } private ArrayList<AccountPreference> getAccountTypePreferences(AuthenticatorHelper helper, private ArrayList<AccountTypePreference> getAccountTypePreferences(AuthenticatorHelper helper, UserHandle userHandle) { final String[] accountTypes = helper.getEnabledAccountTypes(); final ArrayList<AccountPreference> accountTypePreferences = new ArrayList<AccountPreference>(accountTypes.length); final ArrayList<AccountTypePreference> accountTypePreferences = new ArrayList<AccountTypePreference>(accountTypes.length); for (int i = 0; i < accountTypes.length; i++) { final String accountType = accountTypes[i]; Loading @@ -453,17 +457,40 @@ public class AccountPreferenceController extends PreferenceController .getAccountsByTypeAsUser(accountType, userHandle); final boolean skipToAccount = accounts.length == 1 && !helper.hasAccountPreferences(accountType); if (skipToAccount) { final Drawable icon = helper.getDrawableForType(mContext, accountType); final Context prefContext = mParent.getPreferenceManager().getContext(); if (mIAEnabled) { // Add a preference row for each individual account for (Account account : accounts) { final ArrayList<String> auths = helper.getAuthoritiesForAccountType(account.type); if (!AccountRestrictionHelper.showAccount(mAuthorities, auths)) { continue; } final Bundle fragmentArguments = new Bundle(); fragmentArguments.putParcelable(AccountDetailDashboardFragment.KEY_ACCOUNT, account); fragmentArguments.putString(AccountDetailDashboardFragment.KEY_ACCOUNT_TYPE, accountType); fragmentArguments.putString(AccountDetailDashboardFragment.KEY_ACCOUNT_LABEL, label.toString()); fragmentArguments.putInt(AccountDetailDashboardFragment.KEY_ACCOUNT_TITLE_RES, titleResId); fragmentArguments.putParcelable(EXTRA_USER, userHandle); accountTypePreferences.add(new AccountTypePreference( prefContext, account.name, titleResPackageName, titleResId, label, AccountDetailDashboardFragment.class.getName(), fragmentArguments, icon)); } } else if (skipToAccount) { final Bundle fragmentArguments = new Bundle(); fragmentArguments.putParcelable(AccountSyncSettings.ACCOUNT_KEY, accounts[0]); fragmentArguments.putParcelable(EXTRA_USER, userHandle); accountTypePreferences.add(new AccountPreference( mParent.getPreferenceManager().getContext(), label, titleResPackageName, titleResId, AccountSyncSettings.class.getName(), fragmentArguments, helper.getDrawableForType(mContext, accountType))); accountTypePreferences.add(new AccountTypePreference( prefContext, label, titleResPackageName, titleResId, AccountSyncSettings.class.getName(), fragmentArguments, icon)); } else { final Bundle fragmentArguments = new Bundle(); fragmentArguments.putString(ManageAccountsSettings.KEY_ACCOUNT_TYPE, accountType); Loading @@ -471,18 +498,23 @@ public class AccountPreferenceController extends PreferenceController label.toString()); fragmentArguments.putParcelable(EXTRA_USER, userHandle); accountTypePreferences.add(new AccountPreference( mParent.getPreferenceManager().getContext(), label, titleResPackageName, titleResId, ManageAccountsSettings.class.getName(), fragmentArguments, helper.getDrawableForType(mContext, accountType))); accountTypePreferences.add(new AccountTypePreference( prefContext, label, titleResPackageName, titleResId, ManageAccountsSettings.class.getName(), fragmentArguments, icon)); } helper.preloadDrawableForType(mContext, accountType); } // Sort by label Collections.sort(accountTypePreferences, new Comparator<AccountPreference>() { Collections.sort(accountTypePreferences, new Comparator<AccountTypePreference>() { @Override public int compare(AccountPreference t1, AccountPreference t2) { return t1.getitle().toString().compareTo(t2.getitle().toString()); public int compare(AccountTypePreference t1, AccountTypePreference t2) { int result = 0; if (mIAEnabled) { result = t1.getSummary().toString().compareTo(t2.getSummary().toString()); } return result != 0 ? result : t1.getTitle().toString().compareTo(t2.getTitle().toString()); } }); return accountTypePreferences; Loading