blob: 3c394741cb3a8031a4c10910e04c31a05a21cd2e [file] [log] [blame]
Winson Chung321e9ee2010-08-09 13:37:56 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.launcher2;
18
Patrick Dubroy9f7aec82010-09-06 11:03:37 -070019import com.android.launcher.R;
Winson Chung321e9ee2010-08-09 13:37:56 -070020
21import android.content.ComponentName;
22import android.content.Context;
23import android.content.res.TypedArray;
Winson Chung321e9ee2010-08-09 13:37:56 -070024import android.util.AttributeSet;
Winson Chung5f2aa4e2010-08-20 14:49:25 -070025import android.view.ActionMode;
Winson Chung321e9ee2010-08-09 13:37:56 -070026import android.view.LayoutInflater;
Winson Chung5f2aa4e2010-08-20 14:49:25 -070027import android.view.Menu;
28import android.view.MenuItem;
Winson Chung321e9ee2010-08-09 13:37:56 -070029import android.view.View;
Patrick Dubroydea9e932010-09-22 15:04:29 -070030import android.view.ViewGroup;
Winson Chung321e9ee2010-08-09 13:37:56 -070031import android.view.animation.AnimationUtils;
Winson Chung5f2aa4e2010-08-20 14:49:25 -070032import android.widget.Checkable;
Winson Chung321e9ee2010-08-09 13:37:56 -070033import android.widget.TextView;
34
Patrick Dubroy9f7aec82010-09-06 11:03:37 -070035import java.util.ArrayList;
36import java.util.Collections;
Winson Chung321e9ee2010-08-09 13:37:56 -070037
38/**
39 * An implementation of PagedView that populates the pages of the workspace
40 * with all of the user's applications.
41 */
42public class AllAppsPagedView extends PagedView
Winson Chung5f2aa4e2010-08-20 14:49:25 -070043 implements AllAppsView, View.OnClickListener, View.OnLongClickListener, DragSource,
44 DropTarget, ActionMode.Callback {
Winson Chung321e9ee2010-08-09 13:37:56 -070045
46 private static final String TAG = "AllAppsPagedView";
47 private static final boolean DEBUG = false;
48
Patrick Dubroy9f7aec82010-09-06 11:03:37 -070049 private static final int MENU_DELETE_APP = 1;
50 private static final int MENU_APP_INFO = 2;
51
Winson Chung321e9ee2010-08-09 13:37:56 -070052 private Launcher mLauncher;
53 private DragController mDragController;
54
55 // preserve compatibility with 3D all apps:
56 // 0.0 -> hidden
57 // 1.0 -> shown and opaque
58 // intermediate values -> partially shown & partially opaque
59 private float mZoom;
60
61 // set of all applications
62 private ArrayList<ApplicationInfo> mApps;
63 private ArrayList<ApplicationInfo> mFilteredApps;
64
65 // the types of applications to filter
66 static final int ALL_APPS_FLAG = -1;
67 private int mAppFilter = ALL_APPS_FLAG;
68
69 private int mCellCountX;
70 private int mCellCountY;
Winson Chung5ffd8ea2010-09-23 18:40:29 -070071 private int mPageLayoutPaddingTop;
72 private int mPageLayoutPaddingBottom;
73 private int mPageLayoutPaddingLeft;
74 private int mPageLayoutPaddingRight;
Winson Chung321e9ee2010-08-09 13:37:56 -070075
76 private final LayoutInflater mInflater;
77
Patrick Dubroydea9e932010-09-22 15:04:29 -070078 private ViewGroup mOrigInfoButtonParent;
79 private LayoutParams mOrigInfoButtonLayoutParams;
80
81 private ViewGroup mOrigDeleteZoneParent;
82 private LayoutParams mOrigDeleteZoneLayoutParams;
83
Winson Chung321e9ee2010-08-09 13:37:56 -070084 public AllAppsPagedView(Context context) {
85 this(context, null);
86 }
87
88 public AllAppsPagedView(Context context, AttributeSet attrs) {
89 this(context, attrs, 0);
90 }
91
92 public AllAppsPagedView(Context context, AttributeSet attrs, int defStyle) {
93 super(context, attrs, defStyle);
94 TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, defStyle, 0);
95 mCellCountX = a.getInt(R.styleable.PagedView_cellCountX, 6);
96 mCellCountY = a.getInt(R.styleable.PagedView_cellCountY, 4);
Winson Chung5ffd8ea2010-09-23 18:40:29 -070097 mPageLayoutPaddingTop = a.getDimensionPixelSize(
98 R.styleable.PagedView_pageLayoutPaddingTop, 10);
99 mPageLayoutPaddingBottom = a.getDimensionPixelSize(
100 R.styleable.PagedView_pageLayoutPaddingBottom, 10);
101 mPageLayoutPaddingLeft = a.getDimensionPixelSize(
102 R.styleable.PagedView_pageLayoutPaddingLeft, 10);
103 mPageLayoutPaddingRight = a.getDimensionPixelSize(
104 R.styleable.PagedView_pageLayoutPaddingRight, 10);
Winson Chung321e9ee2010-08-09 13:37:56 -0700105 mInflater = LayoutInflater.from(context);
106 a.recycle();
107 setSoundEffectsEnabled(false);
108 }
109
110 @Override
111 public void setLauncher(Launcher launcher) {
112 mLauncher = launcher;
Patrick Dubroy2b9ff372010-09-07 17:49:27 -0700113 mLauncher.setAllAppsPagedView(this);
Winson Chung321e9ee2010-08-09 13:37:56 -0700114 }
115
116 @Override
117 public void setDragController(DragController dragger) {
118 mDragController = dragger;
119 }
120
121 public void setAppFilter(int filterType) {
122 mAppFilter = filterType;
Winson Chung80baf5a2010-08-09 16:03:15 -0700123 if (mApps != null) {
124 mFilteredApps = rebuildFilteredApps(mApps);
Winson Chung86f77532010-08-24 11:08:22 -0700125 setCurrentPage(0);
Winson Chung80baf5a2010-08-09 16:03:15 -0700126 invalidatePageData();
127 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700128 }
129
130 @Override
131 public void zoom(float zoom, boolean animate) {
132 mZoom = zoom;
133 cancelLongPress();
134
135 if (isVisible()) {
136 getParent().bringChildToFront(this);
137 setVisibility(View.VISIBLE);
138 if (animate) {
139 startAnimation(AnimationUtils.loadAnimation(getContext(),
140 R.anim.all_apps_2d_fade_in));
141 } else {
142 onAnimationEnd();
143 }
144 } else {
145 if (animate) {
146 startAnimation(AnimationUtils.loadAnimation(getContext(),
147 R.anim.all_apps_2d_fade_out));
148 } else {
149 onAnimationEnd();
150 }
151 }
152 }
153
154 protected void onAnimationEnd() {
155 if (!isVisible()) {
156 setVisibility(View.GONE);
157 mZoom = 0.0f;
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700158
159 endChoiceMode();
Winson Chung321e9ee2010-08-09 13:37:56 -0700160 } else {
161 mZoom = 1.0f;
162 }
163
164 if (mLauncher != null)
165 mLauncher.zoomed(mZoom);
166 }
167
168 private int getChildIndexForGrandChild(View v) {
169 final int childCount = getChildCount();
170 for (int i = 0; i < childCount; ++i) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700171 final PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(i);
Winson Chung321e9ee2010-08-09 13:37:56 -0700172 if (layout.indexOfChild(v) > -1) {
173 return i;
174 }
175 }
176 return -1;
177 }
178
179 @Override
180 public void onClick(View v) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700181 // if we are already in a choice mode, then just change the selection
182 if (v instanceof Checkable) {
183 if (!isChoiceMode(CHOICE_MODE_NONE)) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700184 Checkable c = (Checkable) v;
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700185 if (isChoiceMode(CHOICE_MODE_SINGLE)) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700186 // Uncheck all the other grandchildren, and toggle the clicked one
187 boolean wasChecked = c.isChecked();
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700188 resetCheckedGrandchildren();
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700189 c.setChecked(!wasChecked);
190 } else {
191 c.toggle();
192 }
193 if (getCheckedGrandchildren().size() == 0) {
194 endChoiceMode();
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700195 }
196
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700197 return;
198 }
199 }
200
201 // otherwise continue and launch the application
Winson Chung321e9ee2010-08-09 13:37:56 -0700202 int childIndex = getChildIndexForGrandChild(v);
Winson Chung86f77532010-08-24 11:08:22 -0700203 if (childIndex == getCurrentPage()) {
Winson Chung321e9ee2010-08-09 13:37:56 -0700204 final ApplicationInfo app = (ApplicationInfo) v.getTag();
205
Winson Chung80baf5a2010-08-09 16:03:15 -0700206 // animate some feedback to the click
207 animateClickFeedback(v, new Runnable() {
Winson Chung321e9ee2010-08-09 13:37:56 -0700208 @Override
Winson Chung80baf5a2010-08-09 16:03:15 -0700209 public void run() {
Winson Chung321e9ee2010-08-09 13:37:56 -0700210 mLauncher.startActivitySafely(app.intent, app);
211 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700212 });
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700213
214 endChoiceMode();
Winson Chung321e9ee2010-08-09 13:37:56 -0700215 }
216 }
217
218 @Override
219 public boolean onLongClick(View v) {
220 if (!v.isInTouchMode()) {
221 return false;
222 }
223
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700224 if (v instanceof Checkable) {
225 // In preparation for drag, we always reset the checked grand children regardless of
226 // what choice mode we are in
227 resetCheckedGrandchildren();
228
229 // Toggle the selection on the dragged app
230 Checkable c = (Checkable) v;
231 c.toggle();
232 }
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700233
Patrick Dubroy430c53b2010-09-08 16:01:19 -0700234 // Start choice mode AFTER the item is selected
235 if (isChoiceMode(CHOICE_MODE_NONE)) {
236 startChoiceMode(CHOICE_MODE_SINGLE, this);
237 }
238
Winson Chung321e9ee2010-08-09 13:37:56 -0700239 ApplicationInfo app = (ApplicationInfo) v.getTag();
240 app = new ApplicationInfo(app);
241
242 mDragController.startDrag(v, this, app, DragController.DRAG_ACTION_COPY);
Winson Chung321e9ee2010-08-09 13:37:56 -0700243 return true;
244 }
245
246 @Override
247 public void onDropCompleted(View target, boolean success) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700248 // close the choice action mode if we have a proper drop
249 if (target != this) {
250 endChoiceMode();
251 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700252 }
253
254 @Override
255 public boolean isVisible() {
256 return mZoom > 0.001f;
257 }
258
259 @Override
260 public boolean isAnimating() {
261 return (getAnimation() != null);
262 }
263
264 private ArrayList<ApplicationInfo> rebuildFilteredApps(ArrayList<ApplicationInfo> apps) {
265 ArrayList<ApplicationInfo> filteredApps = new ArrayList<ApplicationInfo>();
266 if (mAppFilter == ALL_APPS_FLAG) {
267 return apps;
268 } else {
269 final int length = apps.size();
270 for (int i = 0; i < length; ++i) {
271 ApplicationInfo info = apps.get(i);
272 if ((info.flags & mAppFilter) > 0) {
273 filteredApps.add(info);
274 }
275 }
276 }
277 return filteredApps;
278 }
279
280 @Override
281 public void setApps(ArrayList<ApplicationInfo> list) {
282 mApps = list;
Winson Chung80baf5a2010-08-09 16:03:15 -0700283 Collections.sort(mApps, LauncherModel.APP_NAME_COMPARATOR);
Winson Chung321e9ee2010-08-09 13:37:56 -0700284 mFilteredApps = rebuildFilteredApps(mApps);
Winson Chung241c3b42010-08-25 16:53:03 -0700285 mPageViewIconCache.clear();
Winson Chung321e9ee2010-08-09 13:37:56 -0700286 invalidatePageData();
287 }
288
Winson Chung80baf5a2010-08-09 16:03:15 -0700289 private void addAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
290 // we add it in place, in alphabetical order
291 final int count = list.size();
292 for (int i = 0; i < count; ++i) {
293 final ApplicationInfo info = list.get(i);
294 final int index = Collections.binarySearch(mApps, info, LauncherModel.APP_NAME_COMPARATOR);
295 if (index < 0) {
296 mApps.add(-(index + 1), info);
297 }
298 }
299 mFilteredApps = rebuildFilteredApps(mApps);
300 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700301 @Override
302 public void addApps(ArrayList<ApplicationInfo> list) {
Winson Chung80baf5a2010-08-09 16:03:15 -0700303 addAppsWithoutInvalidate(list);
Winson Chung321e9ee2010-08-09 13:37:56 -0700304 invalidatePageData();
305 }
306
Winson Chung80baf5a2010-08-09 16:03:15 -0700307 private void removeAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
Winson Chung321e9ee2010-08-09 13:37:56 -0700308 // loop through all the apps and remove apps that have the same component
309 final int length = list.size();
310 for (int i = 0; i < length; ++i) {
Winson Chung241c3b42010-08-25 16:53:03 -0700311 final ApplicationInfo info = list.get(i);
312 int removeIndex = findAppByComponent(mApps, info);
Winson Chung321e9ee2010-08-09 13:37:56 -0700313 if (removeIndex > -1) {
314 mApps.remove(removeIndex);
Winson Chung241c3b42010-08-25 16:53:03 -0700315 mPageViewIconCache.removeOutline(info);
Winson Chung321e9ee2010-08-09 13:37:56 -0700316 }
317 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700318 mFilteredApps = rebuildFilteredApps(mApps);
319 }
320 @Override
321 public void removeApps(ArrayList<ApplicationInfo> list) {
322 removeAppsWithoutInvalidate(list);
Winson Chung321e9ee2010-08-09 13:37:56 -0700323 invalidatePageData();
324 }
325
326 @Override
327 public void updateApps(ArrayList<ApplicationInfo> list) {
Winson Chung80baf5a2010-08-09 16:03:15 -0700328 removeAppsWithoutInvalidate(list);
329 addAppsWithoutInvalidate(list);
330 invalidatePageData();
Winson Chung321e9ee2010-08-09 13:37:56 -0700331 }
332
333 private int findAppByComponent(ArrayList<ApplicationInfo> list, ApplicationInfo item) {
334 ComponentName removeComponent = item.intent.getComponent();
335 final int length = list.size();
336 for (int i = 0; i < length; ++i) {
337 ApplicationInfo info = list.get(i);
338 if (info.intent.getComponent().equals(removeComponent)) {
339 return i;
340 }
341 }
342 return -1;
343 }
344
345 @Override
346 public void dumpState() {
347 ApplicationInfo.dumpApplicationInfoList(TAG, "mApps", mApps);
348 }
349
350 @Override
351 public void surrender() {
352 // do nothing?
353 }
354
355 @Override
356 public void syncPages() {
357 // ensure that we have the right number of pages
358 int numPages = (int) Math.ceil((float) mFilteredApps.size() / (mCellCountX * mCellCountY));
359 int curNumPages = getChildCount();
360 // remove any extra pages after the "last" page
361 int extraPageDiff = curNumPages - numPages;
362 for (int i = 0; i < extraPageDiff; ++i) {
363 removeViewAt(numPages);
364 }
365 // add any necessary pages
366 for (int i = curNumPages; i < numPages; ++i) {
367 PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
368 layout.setCellCount(mCellCountX, mCellCountY);
Winson Chung5ffd8ea2010-09-23 18:40:29 -0700369 layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
370 mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
Winson Chung321e9ee2010-08-09 13:37:56 -0700371 addView(layout);
372 }
373
374 // bound the current page
Winson Chung86f77532010-08-24 11:08:22 -0700375 setCurrentPage(Math.max(0, Math.min(numPages - 1, getCurrentPage())));
Winson Chung321e9ee2010-08-09 13:37:56 -0700376 }
377
378 @Override
379 public void syncPageItems(int page) {
380 // ensure that we have the right number of items on the pages
Winson Chung80baf5a2010-08-09 16:03:15 -0700381 final int cellsPerPage = mCellCountX * mCellCountY;
382 final int startIndex = page * cellsPerPage;
383 final int endIndex = Math.min(startIndex + cellsPerPage, mFilteredApps.size());
Winson Chung321e9ee2010-08-09 13:37:56 -0700384 PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(page);
Winson Chung80baf5a2010-08-09 16:03:15 -0700385
386 final int curNumPageItems = layout.getChildCount();
387 final int numPageItems = endIndex - startIndex;
388
389 // remove any extra items
390 int extraPageItemsDiff = curNumPageItems - numPageItems;
391 for (int i = 0; i < extraPageItemsDiff; ++i) {
392 layout.removeViewAt(numPageItems);
393 }
394 // add any necessary items
395 for (int i = curNumPageItems; i < numPageItems; ++i) {
Winson Chung321e9ee2010-08-09 13:37:56 -0700396 TextView text = (TextView) mInflater.inflate(R.layout.all_apps_paged_view_application, layout, false);
Winson Chung80baf5a2010-08-09 16:03:15 -0700397 text.setOnClickListener(this);
398 text.setOnLongClickListener(this);
399
400 layout.addViewToCellLayout(text, -1, i,
401 new PagedViewCellLayout.LayoutParams(0, 0, 1, 1));
402 }
403
404 // actually reapply to the existing text views
405 for (int i = startIndex; i < endIndex; ++i) {
Winson Chung241c3b42010-08-25 16:53:03 -0700406 final int index = i - startIndex;
407 final ApplicationInfo info = mFilteredApps.get(i);
408 PagedViewIcon icon = (PagedViewIcon) layout.getChildAt(index);
409 icon.applyFromApplicationInfo(info, mPageViewIconCache);
Winson Chung321e9ee2010-08-09 13:37:56 -0700410
Winson Chung80baf5a2010-08-09 16:03:15 -0700411 PagedViewCellLayout.LayoutParams params =
Winson Chung241c3b42010-08-25 16:53:03 -0700412 (PagedViewCellLayout.LayoutParams) icon.getLayoutParams();
Winson Chung80baf5a2010-08-09 16:03:15 -0700413 params.cellX = index % mCellCountX;
414 params.cellY = index / mCellCountX;
Winson Chung321e9ee2010-08-09 13:37:56 -0700415 }
416 }
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700417
418 @Override
419 public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700420 mode.setTitle(R.string.cab_selection_text);
Patrick Dubroy430c53b2010-09-08 16:01:19 -0700421
Patrick Dubroydea9e932010-09-22 15:04:29 -0700422 // Until the workspace has a selection mode and the CAB supports drag-and-drop, we
423 // take a hybrid approach: grab the views from the workspace and stuff them into the CAB.
424 // When the action mode is done, restore the views to their original place in the toolbar.
425
426 ApplicationInfoDropTarget infoButton =
427 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
428 mOrigInfoButtonParent = (ViewGroup) infoButton.getParent();
429 mOrigInfoButtonLayoutParams = infoButton.getLayoutParams();
430 mOrigInfoButtonParent.removeView(infoButton);
431 infoButton.setManageVisibility(false);
432 infoButton.setVisibility(View.VISIBLE);
433
434 DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
435 mOrigDeleteZoneParent = (ViewGroup) deleteZone.getParent();
436 mOrigDeleteZoneLayoutParams = deleteZone.getLayoutParams();
437 mOrigDeleteZoneParent.removeView(deleteZone);
438 deleteZone.setManageVisibility(false);
439 deleteZone.setVisibility(View.VISIBLE);
440
441 menu.add(0, MENU_APP_INFO, 0, R.string.cab_menu_app_info).setActionView(infoButton);
442 menu.add(0, MENU_DELETE_APP, 0, R.string.cab_menu_delete_app).setActionView(deleteZone);
443
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700444 return true;
445 }
446
447 @Override
448 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700449 mDragController.addDropTarget(this);
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700450 return true;
451 }
452
453 @Override
454 public void onDestroyActionMode(ActionMode mode) {
Patrick Dubroydea9e932010-09-22 15:04:29 -0700455 // Re-parent the drop targets into the toolbar, and restore their layout params
456 ApplicationInfoDropTarget infoButton =
457 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
458 ((ViewGroup) infoButton.getParent()).removeView(infoButton);
459 mOrigInfoButtonParent.addView(infoButton, mOrigInfoButtonLayoutParams);
460 infoButton.setVisibility(View.GONE);
461 infoButton.setManageVisibility(true);
462
463 DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
464 ((ViewGroup) deleteZone.getParent()).removeView(deleteZone);
465 mOrigDeleteZoneParent.addView(deleteZone, mOrigDeleteZoneLayoutParams);
466 deleteZone.setVisibility(View.GONE);
467 deleteZone.setManageVisibility(true);
468
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700469 mDragController.removeDropTarget(this);
470 endChoiceMode();
471 }
472
473 @Override
474 public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700475 final int id = item.getItemId();
476
477 // Assumes that we are in CHOICE_MODE_SINGLE
Patrick Dubroy430c53b2010-09-08 16:01:19 -0700478 final ApplicationInfo appInfo = (ApplicationInfo) getChosenItem();
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700479
480 if (id == MENU_APP_INFO) {
481 mLauncher.startApplicationDetailsActivity(appInfo.componentName);
482 } else if (id == MENU_DELETE_APP) {
Patrick Dubroy5539af72010-09-07 15:22:01 -0700483 mLauncher.startApplicationUninstallActivity(appInfo);
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700484 }
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700485 return false;
486 }
487
488 /*
489 * We don't actually use AllAppsPagedView as a drop target... it's only used to intercept a drop
490 * to the workspace.
491 */
492 @Override
493 public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
494 DragView dragView, Object dragInfo) {
495 return false;
496 }
497 @Override
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700498 public DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset,
499 int yOffset, DragView dragView, Object dragInfo) {
500 return null;
501 }
502 @Override
503 public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
504 DragView dragView, Object dragInfo) {}
505 @Override
506 public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
507 DragView dragView, Object dragInfo) {}
508 @Override
509 public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
510 DragView dragView, Object dragInfo) {}
511 @Override
512 public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
513 DragView dragView, Object dragInfo) {}
Michael Jurka0280c3b2010-09-17 15:00:07 -0700514
515 public boolean isDropEnabled() {
516 return true;
517 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700518}