Update category for AccountDetailDashboardFragment.
- use a separate category key for AccountDetailDashboardFragment instead of sharing the same key with UserAndAccountDashboardFragment. Tile using the original category will now show up at the top level account setting, and tile using the new account detail detail will be displayed under the specified account type. Bug: 62446202 Test: make RunSettingsRoboTests Change-Id: I06f781a20f24498bdc6207aef5469be9cd0c8e47
This commit is contained in:
@@ -81,15 +81,6 @@ public class UserAndAccountDashboardFragment extends DashboardFragment {
|
|||||||
return controllers;
|
return controllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean displayTile(Tile tile) {
|
|
||||||
final Bundle metadata = tile.metaData;
|
|
||||||
if (metadata != null) {
|
|
||||||
return metadata.getString(METADATA_IA_ACCOUNT) == null;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class SummaryProvider implements SummaryLoader.SummaryProvider {
|
private static class SummaryProvider implements SummaryLoader.SummaryProvider {
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
@@ -76,7 +76,7 @@ public class DashboardFragmentRegistry {
|
|||||||
PARENT_TO_CATEGORY_KEY_MAP.put(SecuritySettings.class.getName(),
|
PARENT_TO_CATEGORY_KEY_MAP.put(SecuritySettings.class.getName(),
|
||||||
CategoryKey.CATEGORY_SECURITY);
|
CategoryKey.CATEGORY_SECURITY);
|
||||||
PARENT_TO_CATEGORY_KEY_MAP.put(AccountDetailDashboardFragment.class.getName(),
|
PARENT_TO_CATEGORY_KEY_MAP.put(AccountDetailDashboardFragment.class.getName(),
|
||||||
CategoryKey.CATEGORY_ACCOUNT);
|
CategoryKey.CATEGORY_ACCOUNT_DETAIL);
|
||||||
PARENT_TO_CATEGORY_KEY_MAP.put(UserAndAccountDashboardFragment.class.getName(),
|
PARENT_TO_CATEGORY_KEY_MAP.put(UserAndAccountDashboardFragment.class.getName(),
|
||||||
CategoryKey.CATEGORY_ACCOUNT);
|
CategoryKey.CATEGORY_ACCOUNT);
|
||||||
PARENT_TO_CATEGORY_KEY_MAP.put(
|
PARENT_TO_CATEGORY_KEY_MAP.put(
|
||||||
|
@@ -74,16 +74,16 @@ public class AccountDetailDashboardFragmentTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCategory_isAccount() {
|
public void testCategory_isAccountDetail() {
|
||||||
assertThat(new AccountDetailDashboardFragment().getCategoryKey())
|
assertThat(new AccountDetailDashboardFragment().getCategoryKey())
|
||||||
.isEqualTo(CategoryKey.CATEGORY_ACCOUNT);
|
.isEqualTo(CategoryKey.CATEGORY_ACCOUNT_DETAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void refreshDashboardTiles_HasAccountType_shouldDisplay() {
|
public void refreshDashboardTiles_HasAccountType_shouldDisplay() {
|
||||||
final Tile tile = new Tile();
|
final Tile tile = new Tile();
|
||||||
final Bundle metaData = new Bundle();
|
final Bundle metaData = new Bundle();
|
||||||
metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT);
|
metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT_DETAIL);
|
||||||
metaData.putString(METADATA_ACCOUNT_TYPE, "com.abc");
|
metaData.putString(METADATA_ACCOUNT_TYPE, "com.abc");
|
||||||
tile.metaData = metaData;
|
tile.metaData = metaData;
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ public class AccountDetailDashboardFragmentTest {
|
|||||||
public void refreshDashboardTiles_NoAccountType_shouldNotDisplay() {
|
public void refreshDashboardTiles_NoAccountType_shouldNotDisplay() {
|
||||||
final Tile tile = new Tile();
|
final Tile tile = new Tile();
|
||||||
final Bundle metaData = new Bundle();
|
final Bundle metaData = new Bundle();
|
||||||
metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT);
|
metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT_DETAIL);
|
||||||
tile.metaData = metaData;
|
tile.metaData = metaData;
|
||||||
|
|
||||||
assertThat(mFragment.displayTile(tile)).isFalse();
|
assertThat(mFragment.displayTile(tile)).isFalse();
|
||||||
@@ -104,7 +104,7 @@ public class AccountDetailDashboardFragmentTest {
|
|||||||
public void refreshDashboardTiles_OtherAccountType_shouldNotDisplay() {
|
public void refreshDashboardTiles_OtherAccountType_shouldNotDisplay() {
|
||||||
final Tile tile = new Tile();
|
final Tile tile = new Tile();
|
||||||
final Bundle metaData = new Bundle();
|
final Bundle metaData = new Bundle();
|
||||||
metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT);
|
metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT_DETAIL);
|
||||||
metaData.putString(METADATA_ACCOUNT_TYPE, "com.other");
|
metaData.putString(METADATA_ACCOUNT_TYPE, "com.other");
|
||||||
tile.metaData = metaData;
|
tile.metaData = metaData;
|
||||||
|
|
||||||
|
@@ -66,27 +66,6 @@ public class UserAndAccountDashboardFragmentTest {
|
|||||||
assertThat(mFragment.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_ACCOUNT);
|
assertThat(mFragment.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_ACCOUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void refreshDashboardTiles_HasAccountType_shouldNotDisplay() {
|
|
||||||
final Tile tile = new Tile();
|
|
||||||
final Bundle metaData = new Bundle();
|
|
||||||
metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT);
|
|
||||||
metaData.putString(METADATA_ACCOUNT_TYPE, "com.abc");
|
|
||||||
tile.metaData = metaData;
|
|
||||||
|
|
||||||
assertThat(mFragment.displayTile(tile)).isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void refreshDashboardTiles_NoAccountType_shouldDisplay() {
|
|
||||||
final Tile tile = new Tile();
|
|
||||||
final Bundle metaData = new Bundle();
|
|
||||||
metaData.putString(METADATA_CATEGORY, CategoryKey.CATEGORY_ACCOUNT);
|
|
||||||
tile.metaData = metaData;
|
|
||||||
|
|
||||||
assertThat(mFragment.displayTile(tile)).isTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateSummary_shouldDisplaySignedInUser() {
|
public void updateSummary_shouldDisplaySignedInUser() {
|
||||||
final Activity activity = mock(Activity.class);
|
final Activity activity = mock(Activity.class);
|
||||||
|
Reference in New Issue
Block a user