summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-06-06 22:43:33 -0700
committerAdam Cohen <adamcohen@google.com>2013-06-06 22:44:32 -0700
commit947dc5431981e40ffc8d687604f7777d35915034 (patch)
treec2115c52699f3bbdc7cb30681c65e3b8745ff0a4
parentb5fe60c8a502fb7e265e3183550478b2b2a49264 (diff)
downloadandroid_packages_apps_Trebuchet-947dc5431981e40ffc8d687604f7777d35915034.tar.gz
android_packages_apps_Trebuchet-947dc5431981e40ffc8d687604f7777d35915034.tar.bz2
android_packages_apps_Trebuchet-947dc5431981e40ffc8d687604f7777d35915034.zip
HACK: Getting rid of all apps button / all apps from AppsCustomizePagedView
Change-Id: I74e4a53e9486237ad246ebdfa9e97c6ed9475b58
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java29
-rw-r--r--src/com/android/launcher3/AppsCustomizeTabHost.java5
-rw-r--r--src/com/android/launcher3/DeleteDropTarget.java20
-rw-r--r--src/com/android/launcher3/DragController.java4
-rw-r--r--src/com/android/launcher3/Hotseat.java38
5 files changed, 38 insertions, 58 deletions
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 43a5259a6..df55f048d 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -201,6 +201,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
private AccelerateInterpolator mAlphaInterpolator = new AccelerateInterpolator(0.9f);
private DecelerateInterpolator mLeftScreenAlphaInterpolator = new DecelerateInterpolator(4);
+ public static boolean DISABLE_ALL_APPS = true;
+
// Previews & outlines
ArrayList<AppsCustomizeAsyncTask> mRunningTasks;
private static final int sPageSleepDelay = 200;
@@ -433,7 +435,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
if (!isDataReady()) {
- if (!mApps.isEmpty() && !mWidgets.isEmpty()) {
+ if ((DISABLE_ALL_APPS || !mApps.isEmpty()) && !mWidgets.isEmpty()) {
setDataIsReady();
setMeasuredDimension(width, height);
onDataReady(width, height);
@@ -1546,9 +1548,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
public void setApps(ArrayList<ApplicationInfo> list) {
- mApps = list;
- Collections.sort(mApps, LauncherModel.getAppNameComparator());
- updatePageCountsAndInvalidateData();
+ if (!DISABLE_ALL_APPS) {
+ mApps = list;
+ Collections.sort(mApps, LauncherModel.getAppNameComparator());
+ updatePageCountsAndInvalidateData();
+ }
}
private void addAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
// We add it in place, in alphabetical order
@@ -1561,9 +1565,14 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
}
}
+
public void addApps(ArrayList<ApplicationInfo> list) {
- addAppsWithoutInvalidate(list);
- updatePageCountsAndInvalidateData();
+ if (!DISABLE_ALL_APPS) {
+ addAppsWithoutInvalidate(list);
+ updatePageCountsAndInvalidateData();
+ } else {
+ // TODO: Maybe put them somewhere else?
+ }
}
private int findAppByComponent(List<ApplicationInfo> list, ApplicationInfo item) {
ComponentName removeComponent = item.intent.getComponent();
@@ -1595,9 +1604,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// We remove and re-add the updated applications list because it's properties may have
// changed (ie. the title), and this will ensure that the items will be in their proper
// place in the list.
- removeAppsWithoutInvalidate(list);
- addAppsWithoutInvalidate(list);
- updatePageCountsAndInvalidateData();
+ if (!DISABLE_ALL_APPS) {
+ removeAppsWithoutInvalidate(list);
+ addAppsWithoutInvalidate(list);
+ updatePageCountsAndInvalidateData();
+ }
}
public void reset() {
diff --git a/src/com/android/launcher3/AppsCustomizeTabHost.java b/src/com/android/launcher3/AppsCustomizeTabHost.java
index 5d50fec03..c1f6733f4 100644
--- a/src/com/android/launcher3/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher3/AppsCustomizeTabHost.java
@@ -80,9 +80,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
setCurrentTabByTag(getTabTagForContentType(type));
setOnTabChangedListener(this);
}
- void selectAppsTab() {
- setContentTypeImmediate(AppsCustomizePagedView.ContentType.Applications);
- }
+
void selectWidgetsTab() {
setContentTypeImmediate(AppsCustomizePagedView.ContentType.Widgets);
}
@@ -121,7 +119,6 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
tabView.setText(label);
tabView.setContentDescription(label);
- addTab(newTabSpec(APPS_TAB_TAG).setIndicator(tabView).setContent(contentFactory));
label = getContext().getString(R.string.widgets_tab_label);
tabView = (TextView) mLayoutInflater.inflate(R.layout.tab_widget_indicator, tabs, false);
tabView.setText(label);
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java
index eba154732..d4e17b4c7 100644
--- a/src/com/android/launcher3/DeleteDropTarget.java
+++ b/src/com/android/launcher3/DeleteDropTarget.java
@@ -129,7 +129,12 @@ public class DeleteDropTarget extends ButtonDropTarget {
@Override
public boolean acceptDrop(DragObject d) {
// We can remove everything including App shortcuts, folders, widgets, etc.
- return true;
+ if ((d.dragInfo instanceof LauncherAppWidgetInfo) ||
+ (d.dragInfo instanceof PendingAddWidgetInfo)) {
+ return true;
+ } else {
+ return false;
+ }
}
@Override
@@ -144,13 +149,12 @@ public class DeleteDropTarget extends ButtonDropTarget {
// If we are dragging an application from AppsCustomize, only show the control if we can
// delete the app (it was downloaded), and rename the string to "uninstall" in such a case
- if (isAllAppsApplication(source, info)) {
- ApplicationInfo appInfo = (ApplicationInfo) info;
- if ((appInfo.flags & ApplicationInfo.DOWNLOADED_FLAG) != 0) {
- isUninstall = true;
- } else {
- isVisible = false;
- }
+
+ if ((info instanceof LauncherAppWidgetInfo) ||
+ (info instanceof PendingAddWidgetInfo)) {
+ isVisible = true;
+ } else {
+ isVisible = false;
}
if (isUninstall) {
diff --git a/src/com/android/launcher3/DragController.java b/src/com/android/launcher3/DragController.java
index 86355890e..e0de5b459 100644
--- a/src/com/android/launcher3/DragController.java
+++ b/src/com/android/launcher3/DragController.java
@@ -597,6 +597,10 @@ public class DragController {
if (mDragging) {
PointF vec = isFlingingToDelete(mDragObject.dragSource);
+ if (!(mDragObject.dragInfo instanceof LauncherAppWidgetInfo) &&
+ !(mDragObject.dragInfo instanceof PendingAddWidgetInfo)) {
+ vec = null;
+ }
if (vec != null) {
dropOnFlingToDeleteTarget(dragLayerX, dragLayerY, vec);
} else {
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index 2844d245e..6a625eb95 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -90,7 +90,7 @@ public class Hotseat extends FrameLayout {
return hasVerticalHotseat() ? (mContent.getCountY() - (rank + 1)) : 0;
}
public boolean isAllAppsButtonRank(int rank) {
- return rank == mAllAppsButtonRank;
+ return false;
}
@Override
@@ -107,41 +107,5 @@ public class Hotseat extends FrameLayout {
void resetLayout() {
mContent.removeAllViewsInLayout();
-
- // Add the Apps button
- Context context = getContext();
- LayoutInflater inflater = LayoutInflater.from(context);
- BubbleTextView allAppsButton = (BubbleTextView)
- inflater.inflate(R.layout.application, mContent, false);
- allAppsButton.setCompoundDrawablesWithIntrinsicBounds(null,
- context.getResources().getDrawable(R.drawable.all_apps_button_icon), null, null);
- allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
- allAppsButton.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if (mLauncher != null &&
- (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
- mLauncher.onTouchDownAllAppsButton(v);
- }
- return false;
- }
- });
-
- allAppsButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(android.view.View v) {
- if (mLauncher != null) {
- mLauncher.onClickAllAppsButton(v);
- }
- }
- });
-
- // Note: We do this to ensure that the hotseat is always laid out in the orientation of
- // the hotseat in order regardless of which orientation they were added
- int x = getCellXFromOrder(mAllAppsButtonRank);
- int y = getCellYFromOrder(mAllAppsButtonRank);
- CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x,y,1,1);
- lp.canReorder = false;
- mContent.addViewToCellLayout(allAppsButton, -1, 0, lp, true);
}
}