修改packages/apps/Launcher3/src/com/android/launcher3/Hotseat.java文件
@@ -86,7 +86,7 @@ public class Hotseat extends FrameLayout
}
public boolean isAllAppsButtonRank(int rank) {
- return rank == mAllAppsButtonRank;
+ return false;//rank == mAllAppsButtonRank;
}
@Override
@@ -108,7 +108,7 @@ public class Hotseat extends FrameLayout
void resetLayout() {
mContent.removeAllViewsInLayout();
-
+/*
// Add the Apps button
Context context = getContext();
@@ -140,7 +140,7 @@ public class Hotseat extends FrameLayout
int y = getCellYFromOrder(mAllAppsButtonRank);
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1);
lp.canReorder = false;
- mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
+ mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);*/
}
@Override
修改packages/apps/Launcher3/src/com/android/launcher3/InvariantDeviceProfile.java文件
@@ -97,9 +97,9 @@ public class InvariantDeviceProfile {
InvariantDeviceProfile(String n, float w, float h, int r, int c, int fr, int fc, int maapc,
float is, float its, int hs, float his, int dlId) {
// Ensure that we have an odd number of hotseat items (since we need to place all apps)
- if (hs % 2 == 0) {
- throw new RuntimeException("All Device Profiles must have an odd number of hotseat spaces");
- }
+ //if (hs % 2 == 0) {
+ // throw new RuntimeException("All Device Profiles must have an odd number of hotseat spaces");
+ //}
name = n;
minWidthDps = w;
@@ -193,12 +193,12 @@ public class InvariantDeviceProfile {
// The tablet profile is odd in that the landscape orientation
// also includes the nav bar on the side
predefinedDeviceProfiles.add(new InvariantDeviceProfile("Nexus 7",
- 575, 904, 5, 4, 4, 5, 4, 100, 16.4f, 5, 100, R.xml.default_workspace_5x6));
+ 575, 904, 5, 4, 4, 5, 4, 100, 16.4f, 4, 100, R.xml.default_workspace_5x6));
// Larger tablet profiles always have system bars on the top & bottom
predefinedDeviceProfiles.add(new InvariantDeviceProfile("Nexus 10",
- 727, 1207, 5, 4, 4, 5, 4, 100, 16.4f, 5, 100, R.xml.default_workspace_5x6));
+ 727, 1207, 5, 4, 4, 5, 4, 100, 16.4f, 4, 100, R.xml.default_workspace_5x6));
predefinedDeviceProfiles.add(new InvariantDeviceProfile("20-inch Tablet",
- 1527, 2527, 7, 4, 6, 6, 4, 100, 20, 7, 72, R.xml.default_workspace_5x6));
+ 1527, 2527, 7, 4, 6, 6, 4, 100, 20, 4, 72, R.xml.default_workspace_5x6));
return predefinedDeviceProfiles;
}
修改packages/apps/Launcher3/src/com/android/launcher3/LauncherModel.java文件
@@ -1671,6 +1671,7 @@ public class LauncherModel extends BroadcastReceiver
// second step
if (DEBUG_LOADERS) Log.d(TAG, "step 2: loading all apps");
loadAndBindAllApps();
+ verifyApplications();
}
// Clear out this reference, otherwise we end up holding it until all of the
@@ -3225,7 +3226,9 @@ public class LauncherModel extends BroadcastReceiver
final HashMap<ComponentName, AppInfo> addedOrUpdatedApps = new HashMap<>();
if (added != null) {
- addAppsToAllApps(context, added);
+ final ArrayList<ItemInfo> addedInfos = new ArrayList<ItemInfo>(added);
+ addAndBindAddedWorkspaceItems(context, addedInfos);
+ //addAppsToAllApps(context, added);
for (AppInfo ai : added) {
addedOrUpdatedApps.put(ai.componentName, ai);
}
@@ -3805,4 +3808,26 @@ public class LauncherModel extends BroadcastReceiver
public static Looper getWorkerLooper() {
return sWorkerThread.getLooper();
}
+
+ private void verifyApplications() {
+ final Context context = mApp.getContext();
+
+ // Cross reference all the applications in our apps list with items in the workspace
+ ArrayList<ItemInfo> tmpInfos;
+ ArrayList<ItemInfo> added = new ArrayList<ItemInfo>();
+ synchronized (sBgLock) {
+ for (AppInfo app : mBgAllAppsList.data) {
+ tmpInfos = getItemInfoForComponentName(app.componentName, app.user);
+ if (tmpInfos.isEmpty()) {
+ // We are missing an application icon, so add this to the workspace
+ added.add(app);
+ // This is a rare event, so lets log it
+ }
+ }
+ }
+ if (!added.isEmpty()) {
+ addAndBindAddedWorkspaceItems(context, added);
+ }
+ }
}
以上根据网络大神的修改进行验证