Merge "Move "Blocked numbers" to better location."
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index a0ceed0..7b5f3e6 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -518,6 +518,9 @@
return;
}
+ // Scroll to top after filter is changed.
+ mAllFragment.getListView().setSelectionAfterHeaderView();
+
setFilterAndUpdateTitle(mContactListFilterController.getFilter());
showFabWithAnimation(shouldShowFabForAccount());
diff --git a/src/com/android/contacts/editor/EditorUiUtils.java b/src/com/android/contacts/editor/EditorUiUtils.java
index 844ac45..0a5c765 100644
--- a/src/com/android/contacts/editor/EditorUiUtils.java
+++ b/src/com/android/contacts/editor/EditorUiUtils.java
@@ -137,28 +137,25 @@
public static Pair<String,String> getAccountInfo(Context context, String accountName,
AccountType accountType) {
CharSequence accountTypeDisplayLabel = accountType.getDisplayLabel(context);
- if (TextUtils.isEmpty(accountTypeDisplayLabel)) {
+ if (TextUtils.isEmpty(accountTypeDisplayLabel)
+ || TextUtils.equals(
+ context.getString(R.string.account_phone), accountTypeDisplayLabel)) {
accountTypeDisplayLabel = context.getString(R.string.account_phone);
+ } else if (GoogleAccountType.ACCOUNT_TYPE.equals(accountType.accountType)
+ && accountType.dataSet == null){
+ accountTypeDisplayLabel = context.getString(R.string.google_account_type_format,
+ accountTypeDisplayLabel);
+ } else {
+ accountTypeDisplayLabel = context.getString(R.string.account_type_format,
+ accountTypeDisplayLabel);
}
if (TextUtils.isEmpty(accountName)) {
- return new Pair<>(
- /* accountName =*/ null,
- context.getString(R.string.account_type_format, accountTypeDisplayLabel));
+ return new Pair<>(/* accountName */ null, accountTypeDisplayLabel.toString());
}
- final String accountNameDisplayLabel =
- context.getString(R.string.from_account_format, accountName);
-
- if (GoogleAccountType.ACCOUNT_TYPE.equals(accountType.accountType)
- && accountType.dataSet == null) {
- return new Pair<>(
- accountNameDisplayLabel,
- context.getString(R.string.google_account_type_format, accountTypeDisplayLabel));
- }
- return new Pair<>(
- accountNameDisplayLabel,
- context.getString(R.string.account_type_format, accountTypeDisplayLabel));
+ return new Pair<>(context.getString(R.string.from_account_format, accountName),
+ accountTypeDisplayLabel.toString());
}
/**
diff --git a/tests/src/com/android/contacts/editor/EditorUiUtilsTest.java b/tests/src/com/android/contacts/editor/EditorUiUtilsTest.java
index 1fb5cb7..19f28d3 100644
--- a/tests/src/com/android/contacts/editor/EditorUiUtilsTest.java
+++ b/tests/src/com/android/contacts/editor/EditorUiUtilsTest.java
@@ -119,10 +119,7 @@
assertNotNull(pair);
assertEquals(getContext().getString(R.string.from_account_format, ACCOUNT_NAME),
pair.first); // somebody@lunkedin.com
- assertEquals(
- getContext().getString(R.string.account_type_format,
- getContext().getString(R.string.account_phone)),
- pair.second); // "Phone-only, unsynced contact"
+ assertEquals(getContext().getString(R.string.account_phone), pair.second); // Device
}
public void testGetAccountInfo_NoAccountName_DisplayLabel() {
@@ -133,6 +130,14 @@
assertNull(pair.first);
assertEquals(getContext().getString(R.string.account_type_format, DISPLAY_LABEL),
pair.second); // LunkedIn contact
+
+ final Pair pairDevice = EditorUiUtils.getAccountInfo(
+ getContext(),
+ /* accountName =*/ null,
+ new MockAccountType(getContext().getString(R.string.account_phone)));
+ assertNotNull(pairDevice);
+ assertNull(pairDevice.first);
+ assertEquals(getContext().getString(R.string.account_phone), pairDevice.second); // Device
}
public void testGetAccountInfo_NoAccountName_NoDisplayLabel() {
@@ -141,10 +146,7 @@
assertNotNull(pair);
assertNull(pair.first);
- assertEquals(
- getContext().getString(R.string.account_type_format,
- getContext().getString(R.string.account_phone)),
- pair.second); // "Phone-only, unsynced contact"
+ assertEquals(getContext().getString(R.string.account_phone), pair.second); // Device
}
public void testGetRingtongStrFromUri_lessThanOrEqualsToM() {