summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2014-10-17 16:30:00 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-17 16:30:00 +0000
commit91d79e820aed570ccd2b1a6b10a7b3cabad99479 (patch)
tree8ebd0d41e95848980b975ab0be313af56a56bb48
parentc565c104a6b9f74e68a93108141431d8415881a5 (diff)
parentcee8c66f9a688705f7880f2bffc9d2f95803eb81 (diff)
downloadandroid_packages_apps_Trebuchet-91d79e820aed570ccd2b1a6b10a7b3cabad99479.tar.gz
android_packages_apps_Trebuchet-91d79e820aed570ccd2b1a6b10a7b3cabad99479.tar.bz2
android_packages_apps_Trebuchet-91d79e820aed570ccd2b1a6b10a7b3cabad99479.zip
Merge "Adding ability to list folder items in separate file" into ub-now-queens
-rw-r--r--res/values/attrs.xml2
-rw-r--r--res/xml/default_workspace_4x4_no_all_apps.xml56
-rw-r--r--res/xml/default_workspace_5x5_no_all_apps.xml56
-rw-r--r--res/xml/default_workspace_5x6_no_all_apps.xml56
-rw-r--r--src/com/android/launcher3/DeviceProfile.java7
-rw-r--r--src/com/android/launcher3/DynamicGrid.java33
-rw-r--r--src/com/android/launcher3/LauncherProvider.java13
7 files changed, 21 insertions, 202 deletions
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 65f8f22a6..b4e154336 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -130,12 +130,14 @@
<attr name="title" format="reference" />
<attr name="uri" format="string" />
</declare-styleable>
+
<declare-styleable name="Extra">
<attr name="key" format="string" />
<attr name="value" format="string" />
</declare-styleable>
<declare-styleable name="Include">
<attr name="workspace" format="reference" />
+ <attr name="folderItems" format="reference" />
</declare-styleable>
<declare-styleable name="PreloadIconDrawable">
diff --git a/res/xml/default_workspace_4x4_no_all_apps.xml b/res/xml/default_workspace_4x4_no_all_apps.xml
deleted file mode 100644
index 7e1301cef..000000000
--- a/res/xml/default_workspace_4x4_no_all_apps.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-
-<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3">
- <!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
- <!-- Dialer Hangouts Maps Chrome Camera -->
- <favorite
- launcher:packageName="com.google.android.dialer"
- launcher:className="com.google.android.dialer.extensions.GoogleDialtactsActivity"
- launcher:container="-101"
- launcher:screen="0"
- launcher:x="0"
- launcher:y="0" />
- <favorite
- launcher:packageName="com.google.android.talk"
- launcher:className="com.google.android.talk.SigningInActivity"
- launcher:container="-101"
- launcher:screen="1"
- launcher:x="1"
- launcher:y="0" />
- <favorite
- launcher:packageName="com.google.android.apps.maps"
- launcher:className="com.google.android.maps.MapsActivity"
- launcher:container="-101"
- launcher:screen="2"
- launcher:x="2"
- launcher:y="0"/>
- <favorite
- launcher:packageName="com.android.chrome"
- launcher:className="com.google.android.apps.chrome.Main"
- launcher:container="-101"
- launcher:screen="3"
- launcher:x="3"
- launcher:y="0" />
- <favorite
- launcher:packageName="com.google.android.GoogleCamera"
- launcher:className="com.android.camera.CameraLauncher"
- launcher:container="-101"
- launcher:screen="4"
- launcher:x="4"
- launcher:y="0" />
-</favorites>
-
diff --git a/res/xml/default_workspace_5x5_no_all_apps.xml b/res/xml/default_workspace_5x5_no_all_apps.xml
deleted file mode 100644
index f54a20425..000000000
--- a/res/xml/default_workspace_5x5_no_all_apps.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-
-<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3">
- <!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
- <!-- Dialer Hangouts Maps Chrome Camera -->
- <favorite
- launcher:packageName="com.google.android.dialer"
- launcher:className="com.google.android.dialer.extensions.GoogleDialtactsActivity"
- launcher:container="-101"
- launcher:screen="1"
- launcher:x="1"
- launcher:y="0" />
- <favorite
- launcher:packageName="com.google.android.talk"
- launcher:className="com.google.android.talk.SigningInActivity"
- launcher:container="-101"
- launcher:screen="2"
- launcher:x="2"
- launcher:y="0" />
- <favorite
- launcher:packageName="com.google.android.apps.maps"
- launcher:className="com.google.android.maps.MapsActivity"
- launcher:container="-101"
- launcher:screen="3"
- launcher:x="3"
- launcher:y="0"/>
- <favorite
- launcher:packageName="com.android.chrome"
- launcher:className="com.google.android.apps.chrome.Main"
- launcher:container="-101"
- launcher:screen="4"
- launcher:x="4"
- launcher:y="0" />
- <favorite
- launcher:packageName="com.google.android.GoogleCamera"
- launcher:className="com.android.camera.CameraLauncher"
- launcher:container="-101"
- launcher:screen="5"
- launcher:x="5"
- launcher:y="0" />
-</favorites>
-
diff --git a/res/xml/default_workspace_5x6_no_all_apps.xml b/res/xml/default_workspace_5x6_no_all_apps.xml
deleted file mode 100644
index f54a20425..000000000
--- a/res/xml/default_workspace_5x6_no_all_apps.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-
-<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3">
- <!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
- <!-- Dialer Hangouts Maps Chrome Camera -->
- <favorite
- launcher:packageName="com.google.android.dialer"
- launcher:className="com.google.android.dialer.extensions.GoogleDialtactsActivity"
- launcher:container="-101"
- launcher:screen="1"
- launcher:x="1"
- launcher:y="0" />
- <favorite
- launcher:packageName="com.google.android.talk"
- launcher:className="com.google.android.talk.SigningInActivity"
- launcher:container="-101"
- launcher:screen="2"
- launcher:x="2"
- launcher:y="0" />
- <favorite
- launcher:packageName="com.google.android.apps.maps"
- launcher:className="com.google.android.maps.MapsActivity"
- launcher:container="-101"
- launcher:screen="3"
- launcher:x="3"
- launcher:y="0"/>
- <favorite
- launcher:packageName="com.android.chrome"
- launcher:className="com.google.android.apps.chrome.Main"
- launcher:container="-101"
- launcher:screen="4"
- launcher:x="4"
- launcher:y="0" />
- <favorite
- launcher:packageName="com.google.android.GoogleCamera"
- launcher:className="com.android.camera.CameraLauncher"
- launcher:container="-101"
- launcher:screen="5"
- launcher:x="5"
- launcher:y="0" />
-</favorites>
-
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index daf5556d4..b2366bb2b 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -75,7 +75,6 @@ public class DeviceProfile {
private float hotseatIconSize;
int defaultLayoutId;
- int defaultNoAllAppsLayoutId;
boolean isLandscape;
boolean isTablet;
@@ -136,7 +135,7 @@ public class DeviceProfile {
private ArrayList<DeviceProfileCallbacks> mCallbacks = new ArrayList<DeviceProfileCallbacks>();
DeviceProfile(String n, float w, float h, float r, float c,
- float is, float its, float hs, float his, int dlId, int dnalId) {
+ float is, float its, float hs, float his, int dlId) {
// Ensure that we have an odd number of hotseat items (since we need to place all apps)
if (!LauncherAppState.isDisableAllApps() && hs % 2 == 0) {
throw new RuntimeException("All Device Profiles must have an odd number of hotseat spaces");
@@ -152,7 +151,6 @@ public class DeviceProfile {
numHotseatIcons = hs;
hotseatIconSize = his;
defaultLayoutId = dlId;
- defaultNoAllAppsLayoutId = dnalId;
}
DeviceProfile() {
@@ -215,9 +213,6 @@ public class DeviceProfile {
// Snap to the closest default layout id
defaultLayoutId = closestProfile.defaultLayoutId;
- // Snap to the closest default no all-apps layout id
- defaultNoAllAppsLayoutId = closestProfile.defaultNoAllAppsLayoutId;
-
// Interpolate the icon size
points.clear();
for (DeviceProfile p : profiles) {
diff --git a/src/com/android/launcher3/DynamicGrid.java b/src/com/android/launcher3/DynamicGrid.java
index 94a07d706..aa08148d2 100644
--- a/src/com/android/launcher3/DynamicGrid.java
+++ b/src/com/android/launcher3/DynamicGrid.java
@@ -60,41 +60,30 @@ public class DynamicGrid {
DEFAULT_ICON_SIZE_PX = pxFromDp(DEFAULT_ICON_SIZE_DP, dm);
// Our phone profiles include the bar sizes in each orientation
deviceProfiles.add(new DeviceProfile("Super Short Stubby",
- 255, 300, 2, 3, 48, 13, (hasAA ? 3 : 5), 48, R.xml.default_workspace_4x4,
- R.xml.default_workspace_4x4_no_all_apps));
+ 255, 300, 2, 3, 48, 13, (hasAA ? 3 : 5), 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Shorter Stubby",
- 255, 400, 3, 3, 48, 13, (hasAA ? 3 : 5), 48, R.xml.default_workspace_4x4,
- R.xml.default_workspace_4x4_no_all_apps));
+ 255, 400, 3, 3, 48, 13, (hasAA ? 3 : 5), 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Short Stubby",
- 275, 420, 3, 4, 48, 13, (hasAA ? 5 : 5), 48, R.xml.default_workspace_4x4,
- R.xml.default_workspace_4x4_no_all_apps));
+ 275, 420, 3, 4, 48, 13, (hasAA ? 5 : 5), 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Stubby",
- 255, 450, 3, 4, 48, 13, (hasAA ? 5 : 5), 48, R.xml.default_workspace_4x4,
- R.xml.default_workspace_4x4_no_all_apps));
+ 255, 450, 3, 4, 48, 13, (hasAA ? 5 : 5), 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Nexus S",
- 296, 491.33f, 4, 4, 48, 13, (hasAA ? 5 : 5), 48, R.xml.default_workspace_4x4,
- R.xml.default_workspace_4x4_no_all_apps));
+ 296, 491.33f, 4, 4, 48, 13, (hasAA ? 5 : 5), 48, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Nexus 4",
- 335, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, (hasAA ? 5 : 5), 56, R.xml.default_workspace_4x4,
- R.xml.default_workspace_4x4_no_all_apps));
+ 335, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, (hasAA ? 5 : 5), 56, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Nexus 5",
- 359, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, (hasAA ? 5 : 5), 56, R.xml.default_workspace_4x4,
- R.xml.default_workspace_4x4_no_all_apps));
+ 359, 567, 4, 4, DEFAULT_ICON_SIZE_DP, 13, (hasAA ? 5 : 5), 56, R.xml.default_workspace_4x4));
deviceProfiles.add(new DeviceProfile("Large Phone",
- 406, 694, 5, 5, 64, 14.4f, 5, 56, R.xml.default_workspace_5x5,
- R.xml.default_workspace_5x5_no_all_apps));
+ 406, 694, 5, 5, 64, 14.4f, 5, 56, R.xml.default_workspace_5x5));
// The tablet profile is odd in that the landscape orientation
// also includes the nav bar on the side
deviceProfiles.add(new DeviceProfile("Nexus 7",
- 575, 904, 5, 6, 72, 14.4f, 7, 60, R.xml.default_workspace_5x6,
- R.xml.default_workspace_5x6_no_all_apps));
+ 575, 904, 5, 6, 72, 14.4f, 7, 60, R.xml.default_workspace_5x6));
// Larger tablet profiles always have system bars on the top & bottom
deviceProfiles.add(new DeviceProfile("Nexus 10",
- 727, 1207, 5, 6, 76, 14.4f, 7, 64, R.xml.default_workspace_5x6,
- R.xml.default_workspace_5x6_no_all_apps));
+ 727, 1207, 5, 6, 76, 14.4f, 7, 64, R.xml.default_workspace_5x6));
deviceProfiles.add(new DeviceProfile("20-inch Tablet",
- 1527, 2527, 7, 7, 100, 20, 7, 72, R.xml.default_workspace_4x4,
- R.xml.default_workspace_4x4_no_all_apps));
+ 1527, 2527, 7, 7, 100, 20, 7, 72, R.xml.default_workspace_4x4));
mMinWidth = dpiFromPx(minWidthPx, dm);
mMinHeight = dpiFromPx(minHeightPx, dm);
mProfile = new DeviceProfile(context, deviceProfiles,
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 7a0a8fa9d..0272dfd54 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -360,11 +360,7 @@ public class LauncherProvider extends ContentProvider {
private static int getDefaultWorkspaceResourceId() {
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
- if (LauncherAppState.isDisableAllApps()) {
- return grid.defaultNoAllAppsLayoutId;
- } else {
- return grid.defaultLayoutId;
- }
+ return grid.defaultLayoutId;
}
private static interface ContentValuesCallback {
@@ -399,6 +395,7 @@ public class LauncherProvider extends ContentProvider {
private static final String TAG_PARTNER_FOLDER = "partner-folder";
private static final String TAG_EXTRA = "extra";
private static final String TAG_INCLUDE = "include";
+ private static final String TAG_FOLDER_ITEMS = "folderitems";
// Style attrs -- "Favorite"
private static final String ATTR_CLASS_NAME = "className";
@@ -415,6 +412,7 @@ public class LauncherProvider extends ContentProvider {
// Style attrs -- "Include"
private static final String ATTR_WORKSPACE = "workspace";
+ private static final String ATTR_FOLDER_ITEMS = "folderItems";
// Style attrs -- "Extra"
private static final String ATTR_KEY = "key";
@@ -1588,7 +1586,10 @@ public class LauncherProvider extends ContentProvider {
folderItems.add(id);
}
} else if (TAG_INCLUDE.equals(tag) && folderId >= 0) {
- addToFolder(db, res, parser, folderItems, folderId);
+ final int resId = getAttributeResourceValue(parser, ATTR_FOLDER_ITEMS, 0);
+ XmlResourceParser itemsParser = res.getXml(resId);
+ beginDocument(itemsParser, TAG_FOLDER_ITEMS);
+ addToFolder(db, res, itemsParser, folderItems, folderId);
} else {
throw new RuntimeException("Folders can contain only shortcuts");
}