OSDN Git Service

Allow 5 hotseat icons in DISABLE_ALL_APPS mode.
authorNilesh Agrawal <nileshagrawal@google.com>
Mon, 9 Dec 2013 22:17:49 +0000 (14:17 -0800)
committerNilesh Agrawal <nileshagrawal@google.com>
Mon, 9 Dec 2013 22:37:59 +0000 (14:37 -0800)
Added the xml resource in Launcher3 package as well.
This is a dummy resource with just hotseat icons.
Previously reviewed on: http://ag/396580

Change-Id: I31b0d7d4796d028f44f746260c381f2d8226605a

res/xml/default_workspace_no_all_apps.xml [new file with mode: 0644]
src/com/android/launcher3/DynamicGrid.java
src/com/android/launcher3/LauncherProvider.java

diff --git a/res/xml/default_workspace_no_all_apps.xml b/res/xml/default_workspace_no_all_apps.xml
new file mode 100644 (file)
index 0000000..7e1301c
--- /dev/null
@@ -0,0 +1,56 @@
+<?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>
+
index ce78553..dc01c69 100644 (file)
@@ -60,17 +60,17 @@ 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 ? 5 : 4), 48));
+                255, 300,  2, 3,  48, 13, (hasAA ? 5 : 5), 48));
         deviceProfiles.add(new DeviceProfile("Shorter Stubby",
-                255, 400,  3, 3,  48, 13, (hasAA ? 5 : 4), 48));
+                255, 400,  3, 3,  48, 13, (hasAA ? 5 : 5), 48));
         deviceProfiles.add(new DeviceProfile("Short Stubby",
-                275, 420,  3, 4,  48, 13, (hasAA ? 5 : 4), 48));
+                275, 420,  3, 4,  48, 13, (hasAA ? 5 : 5), 48));
         deviceProfiles.add(new DeviceProfile("Stubby",
-                255, 450,  3, 4,  48, 13, (hasAA ? 5 : 4), 48));
+                255, 450,  3, 4,  48, 13, (hasAA ? 5 : 5), 48));
         deviceProfiles.add(new DeviceProfile("Nexus S",
-                296, 491.33f,  4, 4,  48, 13, (hasAA ? 5 : 4), 48));
+                296, 491.33f,  4, 4,  48, 13, (hasAA ? 5 : 5), 48));
         deviceProfiles.add(new DeviceProfile("Nexus 4",
-                359, 518,  4, 4,  DEFAULT_ICON_SIZE_DP, 13, (hasAA ? 5 : 4), 56));
+                359, 518,  4, 4,  DEFAULT_ICON_SIZE_DP, 13, (hasAA ? 5 : 5), 56));
         // The tablet profile is odd in that the landscape orientation
         // also includes the nav bar on the side
         deviceProfiles.add(new DeviceProfile("Nexus 7",
index 27b7dae..28efd01 100644 (file)
@@ -270,7 +270,8 @@ public class LauncherProvider extends ContentProvider {
 
             // Use default workspace resource if none provided
             if (workspaceResId == 0) {
-                workspaceResId = sp.getInt(DEFAULT_WORKSPACE_RESOURCE_ID, R.xml.default_workspace);
+                workspaceResId =
+                        sp.getInt(DEFAULT_WORKSPACE_RESOURCE_ID, getDefaultWorkspaceResourceId());
             }
 
             // Populate favorites table with initial favorites
@@ -286,6 +287,14 @@ public class LauncherProvider extends ContentProvider {
         }
     }
 
+    private static int getDefaultWorkspaceResourceId() {
+        if (AppsCustomizePagedView.DISABLE_ALL_APPS) {
+            return R.xml.default_workspace_no_all_apps;
+        } else {
+            return R.xml.default_workspace;
+        }
+    }
+
     private static interface ContentValuesCallback {
         public void onRow(ContentValues values);
     }