Loading robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,22 @@ public class DefaultLayoutProviderTest { assertEquals(3, ((FolderInfo) info).contents.size()); } @Test public void testCustomProfileLoaded_with_folder_custom_title() throws Exception { writeLayoutAndLoad(new LauncherLayoutBuilder().atHotseat(0).putFolder("CustomFolder") .addApp(TEST_PACKAGE, TEST_PACKAGE) .addApp(TEST_PACKAGE, TEST_PACKAGE) .addApp(TEST_PACKAGE, TEST_PACKAGE) .build()); // Verify folder assertEquals(1, mModelHelper.getBgDataModel().workspaceItems.size()); ItemInfo info = mModelHelper.getBgDataModel().workspaceItems.get(0); assertEquals(LauncherSettings.Favorites.ITEM_TYPE_FOLDER, info.itemType); assertEquals(3, ((FolderInfo) info).contents.size()); assertEquals("CustomFolder", info.title.toString()); } @Test public void testCustomProfileLoaded_with_widget() throws Exception { String pendingAppPkg = "com.test.pending"; Loading robolectric_tests/src/com/android/launcher3/util/LauncherLayoutBuilder.java +11 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public class LauncherLayoutBuilder { private static final String ATTR_PACKAGE_NAME = "packageName"; private static final String ATTR_CLASS_NAME = "className"; private static final String ATTR_TITLE = "title"; private static final String ATTR_TITLE_TEXT = "titleText"; private static final String ATTR_SCREEN = "screen"; // x and y can be specified as negative integers, in which case -1 represents the Loading Loading @@ -145,8 +146,17 @@ public class LauncherLayoutBuilder { } public FolderBuilder putFolder(int titleResId) { FolderBuilder folderBuilder = new FolderBuilder(); items.put(ATTR_TITLE, Integer.toString(titleResId)); return putFolder(); } public FolderBuilder putFolder(String title) { items.put(ATTR_TITLE_TEXT, title); return putFolder(); } private FolderBuilder putFolder() { FolderBuilder folderBuilder = new FolderBuilder(); items.put(ATTR_CHILDREN, folderBuilder.mChildren); mNodes.add(Pair.create(TAG_FOLDER, items)); return folderBuilder; Loading src/com/android/launcher3/AutoInstallsLayout.java +3 −1 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ public class AutoInstallsLayout { private static final String ATTR_PACKAGE_NAME = "packageName"; private static final String ATTR_CLASS_NAME = "className"; private static final String ATTR_TITLE = "title"; private static final String ATTR_TITLE_TEXT = "titleText"; private static final String ATTR_SCREEN = "screen"; // x and y can be specified as negative integers, in which case -1 represents the Loading Loading @@ -585,7 +586,8 @@ public class AutoInstallsLayout { if (titleResId != 0) { title = mSourceRes.getString(titleResId); } else { title = ""; String titleText = getAttributeValue(parser, ATTR_TITLE_TEXT); title = TextUtils.isEmpty(titleText) ? "" : titleText; } mValues.put(Favorites.TITLE, title); Loading Loading
robolectric_tests/src/com/android/launcher3/model/DefaultLayoutProviderTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,22 @@ public class DefaultLayoutProviderTest { assertEquals(3, ((FolderInfo) info).contents.size()); } @Test public void testCustomProfileLoaded_with_folder_custom_title() throws Exception { writeLayoutAndLoad(new LauncherLayoutBuilder().atHotseat(0).putFolder("CustomFolder") .addApp(TEST_PACKAGE, TEST_PACKAGE) .addApp(TEST_PACKAGE, TEST_PACKAGE) .addApp(TEST_PACKAGE, TEST_PACKAGE) .build()); // Verify folder assertEquals(1, mModelHelper.getBgDataModel().workspaceItems.size()); ItemInfo info = mModelHelper.getBgDataModel().workspaceItems.get(0); assertEquals(LauncherSettings.Favorites.ITEM_TYPE_FOLDER, info.itemType); assertEquals(3, ((FolderInfo) info).contents.size()); assertEquals("CustomFolder", info.title.toString()); } @Test public void testCustomProfileLoaded_with_widget() throws Exception { String pendingAppPkg = "com.test.pending"; Loading
robolectric_tests/src/com/android/launcher3/util/LauncherLayoutBuilder.java +11 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public class LauncherLayoutBuilder { private static final String ATTR_PACKAGE_NAME = "packageName"; private static final String ATTR_CLASS_NAME = "className"; private static final String ATTR_TITLE = "title"; private static final String ATTR_TITLE_TEXT = "titleText"; private static final String ATTR_SCREEN = "screen"; // x and y can be specified as negative integers, in which case -1 represents the Loading Loading @@ -145,8 +146,17 @@ public class LauncherLayoutBuilder { } public FolderBuilder putFolder(int titleResId) { FolderBuilder folderBuilder = new FolderBuilder(); items.put(ATTR_TITLE, Integer.toString(titleResId)); return putFolder(); } public FolderBuilder putFolder(String title) { items.put(ATTR_TITLE_TEXT, title); return putFolder(); } private FolderBuilder putFolder() { FolderBuilder folderBuilder = new FolderBuilder(); items.put(ATTR_CHILDREN, folderBuilder.mChildren); mNodes.add(Pair.create(TAG_FOLDER, items)); return folderBuilder; Loading
src/com/android/launcher3/AutoInstallsLayout.java +3 −1 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ public class AutoInstallsLayout { private static final String ATTR_PACKAGE_NAME = "packageName"; private static final String ATTR_CLASS_NAME = "className"; private static final String ATTR_TITLE = "title"; private static final String ATTR_TITLE_TEXT = "titleText"; private static final String ATTR_SCREEN = "screen"; // x and y can be specified as negative integers, in which case -1 represents the Loading Loading @@ -585,7 +586,8 @@ public class AutoInstallsLayout { if (titleResId != 0) { title = mSourceRes.getString(titleResId); } else { title = ""; String titleText = getAttributeValue(parser, ATTR_TITLE_TEXT); title = TextUtils.isEmpty(titleText) ? "" : titleText; } mValues.put(Favorites.TITLE, title); Loading