summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Launcher.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-09-03 17:48:37 -0700
committerWinson Chung <winsonc@google.com>2013-09-05 12:14:28 -0700
commitc58497ee619416c4949b16eb43486c11618b69e5 (patch)
treeb8bfd3ec331885a25f42c69fb41dbfd861a4763a /src/com/android/launcher3/Launcher.java
parent2d8de5845be5f49d3767b8354f0d5479a0715abe (diff)
downloadandroid_packages_apps_Trebuchet-c58497ee619416c4949b16eb43486c11618b69e5.tar.gz
android_packages_apps_Trebuchet-c58497ee619416c4949b16eb43486c11618b69e5.tar.bz2
android_packages_apps_Trebuchet-c58497ee619416c4949b16eb43486c11618b69e5.zip
Initial changes to restore AllApps.
- Removes unused all apps code due to dynamic grid/spacing - Attempts to use CellLayout instead of PagedViewCellLayout Change-Id: I3c49bca9fc35dfeaf250591fd63bc7f36119968f
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r--src/com/android/launcher3/Launcher.java62
1 files changed, 48 insertions, 14 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 81a962d0c..ec84a9ac0 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -795,7 +795,7 @@ public class Launcher extends Activity
if (mOnResumeState == State.WORKSPACE) {
showWorkspace(false);
} else if (mOnResumeState == State.APPS_CUSTOMIZE) {
- showAllApps(false);
+ showAllApps(false, AppsCustomizePagedView.ContentType.Applications);
}
mOnResumeState = State.NONE;
@@ -1118,7 +1118,7 @@ public class Launcher extends Activity
findViewById(R.id.widget_button).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
- showAllApps(true);
+ showAllApps(true, AppsCustomizePagedView.ContentType.Widgets);
}
});
findViewById(R.id.wallpaper_button).setOnClickListener(new OnClickListener() {
@@ -2183,7 +2183,7 @@ public class Launcher extends Activity
final String shortcutClass = intent.getComponent().getClassName();
if (shortcutClass.equals(WidgetAdder.class.getName())) {
- showAllApps(true);
+ showAllApps(true, AppsCustomizePagedView.ContentType.Widgets);
return;
} else if (shortcutClass.equals(MemoryDumpActivity.class.getName())) {
MemoryDumpActivity.startDump(this);
@@ -2273,7 +2273,7 @@ public class Launcher extends Activity
* @param v The view that was clicked.
*/
public void onClickAllAppsButton(View v) {
- showAllApps(true);
+ showAllApps(true, AppsCustomizePagedView.ContentType.Applications);
}
public void onTouchDownAllAppsButton(View v) {
@@ -2742,6 +2742,11 @@ public class Launcher extends Activity
* of the screen.
*/
private void showAppsCustomizeHelper(final boolean animated, final boolean springLoaded) {
+ AppsCustomizePagedView.ContentType contentType = mAppsCustomizeContent.getContentType();
+ showAppsCustomizeHelper(animated, springLoaded, contentType);
+ }
+ private void showAppsCustomizeHelper(final boolean animated, final boolean springLoaded,
+ final AppsCustomizePagedView.ContentType contentType) {
if (mStateAnimation != null) {
mStateAnimation.setDuration(0);
mStateAnimation.cancel();
@@ -2762,6 +2767,10 @@ public class Launcher extends Activity
// Shrink workspaces away if going to AppsCustomize from workspace
Animator workspaceAnim =
mWorkspace.getChangeStateAnimation(Workspace.State.SMALL, animated);
+ if (!AppsCustomizePagedView.DISABLE_ALL_APPS) {
+ // Set the content type for the all apps space
+ mAppsCustomizeTabHost.setContentTypeImmediate(contentType);
+ }
if (animated) {
toView.setScaleX(scale);
@@ -3053,10 +3062,11 @@ public class Launcher extends Activity
public void onWorkspaceShown(boolean animated) {
}
- void showAllApps(boolean animated) {
+ void showAllApps(boolean animated,
+ AppsCustomizePagedView.ContentType contentType) {
if (mState != State.WORKSPACE) return;
- showAppsCustomizeHelper(animated, false);
+ showAppsCustomizeHelper(animated, false, contentType);
mAppsCustomizeTabHost.requestFocus();
// Change the state *after* we've called all the transition code
@@ -3609,10 +3619,11 @@ public class Launcher extends Activity
public void bindAppsAdded(final ArrayList<Long> newScreens,
final ArrayList<ItemInfo> addNotAnimated,
- final ArrayList<ItemInfo> addAnimated) {
+ final ArrayList<ItemInfo> addAnimated,
+ final ArrayList<AppInfo> addedApps) {
Runnable r = new Runnable() {
public void run() {
- bindAppsAdded(newScreens, addNotAnimated, addAnimated);
+ bindAppsAdded(newScreens, addNotAnimated, addAnimated, addedApps);
}
};
if (waitUntilResume(r)) {
@@ -3634,6 +3645,11 @@ public class Launcher extends Activity
bindItems(addAnimated, 0,
addAnimated.size(), true);
}
+
+ if (!AppsCustomizePagedView.DISABLE_ALL_APPS &&
+ addedApps != null && mAppsCustomizeContent != null) {
+ mAppsCustomizeContent.addApps(addedApps);
+ }
}
/**
@@ -3875,12 +3891,19 @@ public class Launcher extends Activity
* Implementation of the method from LauncherModel.Callbacks.
*/
public void bindAllApplications(final ArrayList<AppInfo> apps) {
- if (mIntentsOnWorkspaceFromUpgradePath != null) {
- if (LauncherModel.UPGRADE_USE_MORE_APPS_FOLDER) {
- getHotseat().addAllAppsFolder(mIconCache, apps,
- mIntentsOnWorkspaceFromUpgradePath, Launcher.this, mWorkspace);
+ if (AppsCustomizePagedView.DISABLE_ALL_APPS) {
+ if (mIntentsOnWorkspaceFromUpgradePath != null) {
+ if (LauncherModel.UPGRADE_USE_MORE_APPS_FOLDER) {
+ getHotseat().addAllAppsFolder(mIconCache, apps,
+ mIntentsOnWorkspaceFromUpgradePath, Launcher.this, mWorkspace);
+ }
+ mIntentsOnWorkspaceFromUpgradePath = null;
+ }
+ } else {
+ if (!AppsCustomizePagedView.DISABLE_ALL_APPS &&
+ mAppsCustomizeContent != null) {
+ mAppsCustomizeContent.setApps(apps);
}
- mIntentsOnWorkspaceFromUpgradePath = null;
}
}
@@ -3902,6 +3925,11 @@ public class Launcher extends Activity
if (mWorkspace != null) {
mWorkspace.updateShortcuts(apps);
}
+
+ if (!AppsCustomizePagedView.DISABLE_ALL_APPS &&
+ mAppsCustomizeContent != null) {
+ mAppsCustomizeContent.updateApps(apps);
+ }
}
/**
@@ -3933,6 +3961,11 @@ public class Launcher extends Activity
// Notify the drag controller
mDragController.onAppsRemoved(appInfos, this);
+
+ if (!AppsCustomizePagedView.DISABLE_ALL_APPS &&
+ mAppsCustomizeContent != null) {
+ mAppsCustomizeContent.removeApps(appInfos);
+ }
}
/**
@@ -3953,7 +3986,8 @@ public class Launcher extends Activity
}
// Update the widgets pane
- if (mAppsCustomizeContent != null) {
+ if (!AppsCustomizePagedView.DISABLE_ALL_APPS &&
+ mAppsCustomizeContent != null) {
mAppsCustomizeContent.onPackagesUpdated(widgetsAndShortcuts);
}
}