blob: 2fd0b65691987db078fc2ad6828cfc64beb6c430 [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
Michael Jurkaaf91de02010-11-23 16:23:58 -080019import 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;
Michael Jurkad3ef3062010-11-23 16:23:58 -080024import android.graphics.Bitmap;
25import android.graphics.Canvas;
26import android.graphics.drawable.Drawable;
Winson Chung321e9ee2010-08-09 13:37:56 -070027import android.util.AttributeSet;
Michael Jurkad3ef3062010-11-23 16:23:58 -080028import android.util.Log;
Winson Chung321e9ee2010-08-09 13:37:56 -070029import android.view.LayoutInflater;
30import android.view.View;
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
Michael Jurkaaf91de02010-11-23 16:23:58 -080035import java.util.ArrayList;
36import java.util.Collections;
37import java.util.HashSet;
Winson Chung321e9ee2010-08-09 13:37:56 -070038
39/**
40 * An implementation of PagedView that populates the pages of the workspace
41 * with all of the user's applications.
42 */
43public class AllAppsPagedView extends PagedView
Winson Chung5f2aa4e2010-08-20 14:49:25 -070044 implements AllAppsView, View.OnClickListener, View.OnLongClickListener, DragSource,
Adam Cohencdc30d52010-12-01 15:09:47 -080045 DropTarget {
Winson Chung321e9ee2010-08-09 13:37:56 -070046
47 private static final String TAG = "AllAppsPagedView";
48 private static final boolean DEBUG = false;
49
50 private Launcher mLauncher;
51 private DragController mDragController;
52
53 // preserve compatibility with 3D all apps:
54 // 0.0 -> hidden
55 // 1.0 -> shown and opaque
56 // intermediate values -> partially shown & partially opaque
57 private float mZoom;
58
59 // set of all applications
60 private ArrayList<ApplicationInfo> mApps;
61 private ArrayList<ApplicationInfo> mFilteredApps;
62
63 // the types of applications to filter
64 static final int ALL_APPS_FLAG = -1;
65 private int mAppFilter = ALL_APPS_FLAG;
66
Winson Chung321e9ee2010-08-09 13:37:56 -070067 private final LayoutInflater mInflater;
68
Patrick Dubroydea9e932010-09-22 15:04:29 -070069
Winson Chung321e9ee2010-08-09 13:37:56 -070070 public AllAppsPagedView(Context context) {
71 this(context, null);
72 }
73
74 public AllAppsPagedView(Context context, AttributeSet attrs) {
75 this(context, attrs, 0);
76 }
77
78 public AllAppsPagedView(Context context, AttributeSet attrs, int defStyle) {
79 super(context, attrs, defStyle);
80 TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, defStyle, 0);
81 mCellCountX = a.getInt(R.styleable.PagedView_cellCountX, 6);
82 mCellCountY = a.getInt(R.styleable.PagedView_cellCountY, 4);
83 mInflater = LayoutInflater.from(context);
84 a.recycle();
85 setSoundEffectsEnabled(false);
86 }
87
88 @Override
Winson Chung7da10252010-10-28 16:07:04 -070089 protected void init() {
90 super.init();
91 mCenterPagesVertically = false;
92 }
93
94 @Override
Winson Chung321e9ee2010-08-09 13:37:56 -070095 public void setLauncher(Launcher launcher) {
96 mLauncher = launcher;
Patrick Dubroy2b9ff372010-09-07 17:49:27 -070097 mLauncher.setAllAppsPagedView(this);
Winson Chung321e9ee2010-08-09 13:37:56 -070098 }
99
100 @Override
101 public void setDragController(DragController dragger) {
102 mDragController = dragger;
103 }
104
105 public void setAppFilter(int filterType) {
106 mAppFilter = filterType;
Winson Chung80baf5a2010-08-09 16:03:15 -0700107 if (mApps != null) {
108 mFilteredApps = rebuildFilteredApps(mApps);
Winson Chung86f77532010-08-24 11:08:22 -0700109 setCurrentPage(0);
Winson Chung80baf5a2010-08-09 16:03:15 -0700110 invalidatePageData();
111 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700112 }
113
114 @Override
115 public void zoom(float zoom, boolean animate) {
116 mZoom = zoom;
117 cancelLongPress();
118
119 if (isVisible()) {
120 getParent().bringChildToFront(this);
121 setVisibility(View.VISIBLE);
122 if (animate) {
123 startAnimation(AnimationUtils.loadAnimation(getContext(),
124 R.anim.all_apps_2d_fade_in));
125 } else {
126 onAnimationEnd();
127 }
128 } else {
129 if (animate) {
130 startAnimation(AnimationUtils.loadAnimation(getContext(),
131 R.anim.all_apps_2d_fade_out));
132 } else {
133 onAnimationEnd();
134 }
135 }
136 }
137
138 protected void onAnimationEnd() {
139 if (!isVisible()) {
140 setVisibility(View.GONE);
141 mZoom = 0.0f;
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700142
143 endChoiceMode();
Winson Chung321e9ee2010-08-09 13:37:56 -0700144 } else {
145 mZoom = 1.0f;
146 }
147
148 if (mLauncher != null)
149 mLauncher.zoomed(mZoom);
150 }
151
152 private int getChildIndexForGrandChild(View v) {
153 final int childCount = getChildCount();
154 for (int i = 0; i < childCount; ++i) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700155 final PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(i);
Winson Chung321e9ee2010-08-09 13:37:56 -0700156 if (layout.indexOfChild(v) > -1) {
157 return i;
158 }
159 }
160 return -1;
161 }
162
163 @Override
164 public void onClick(View v) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700165 // if we are already in a choice mode, then just change the selection
166 if (v instanceof Checkable) {
167 if (!isChoiceMode(CHOICE_MODE_NONE)) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700168 Checkable c = (Checkable) v;
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700169 if (isChoiceMode(CHOICE_MODE_SINGLE)) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700170 // Uncheck all the other grandchildren, and toggle the clicked one
171 boolean wasChecked = c.isChecked();
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700172 resetCheckedGrandchildren();
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700173 c.setChecked(!wasChecked);
174 } else {
175 c.toggle();
176 }
177 if (getCheckedGrandchildren().size() == 0) {
178 endChoiceMode();
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700179 }
180
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700181 return;
182 }
183 }
184
185 // otherwise continue and launch the application
Winson Chung321e9ee2010-08-09 13:37:56 -0700186 int childIndex = getChildIndexForGrandChild(v);
Winson Chung86f77532010-08-24 11:08:22 -0700187 if (childIndex == getCurrentPage()) {
Winson Chung321e9ee2010-08-09 13:37:56 -0700188 final ApplicationInfo app = (ApplicationInfo) v.getTag();
189
Winson Chung80baf5a2010-08-09 16:03:15 -0700190 // animate some feedback to the click
191 animateClickFeedback(v, new Runnable() {
Winson Chung321e9ee2010-08-09 13:37:56 -0700192 @Override
Winson Chung80baf5a2010-08-09 16:03:15 -0700193 public void run() {
Winson Chung321e9ee2010-08-09 13:37:56 -0700194 mLauncher.startActivitySafely(app.intent, app);
195 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700196 });
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700197
198 endChoiceMode();
Winson Chung321e9ee2010-08-09 13:37:56 -0700199 }
200 }
201
Adam Cohencdc30d52010-12-01 15:09:47 -0800202 private void setupDragMode() {
Michael Jurkaaf91de02010-11-23 16:23:58 -0800203 mLauncher.getWorkspace().shrink(Workspace.ShrinkState.BOTTOM_VISIBLE);
Adam Cohencdc30d52010-12-01 15:09:47 -0800204
205 ApplicationInfoDropTarget infoButton =
206 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
207 infoButton.setDragAndDropEnabled(false);
208 DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
209 deleteZone.setDragAndDropEnabled(false);
210
211 ApplicationInfoDropTarget allAppsInfoButton =
212 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target);
213 allAppsInfoButton.setDragAndDropEnabled(true);
214 DeleteZone allAppsDeleteZone = (DeleteZone)
215 mLauncher.findViewById(R.id.all_apps_delete_zone);
216 allAppsDeleteZone.setDragAndDropEnabled(true);
217 }
218
219 private void tearDownDragMode() {
220 post(new Runnable() {
221 // Once the drag operation has fully completed, hence the post, we want to disable the
222 // deleteZone and the appInfoButton in all apps, and re-enable the instance which
223 // live in the workspace
224 public void run() {
225 ApplicationInfoDropTarget infoButton =
226 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
227 infoButton.setDragAndDropEnabled(true);
228 DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
229 deleteZone.setDragAndDropEnabled(true);
230
231 ApplicationInfoDropTarget allAppsInfoButton =
232 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target);
233 allAppsInfoButton.setDragAndDropEnabled(false);
234 DeleteZone allAppsDeleteZone =
235 (DeleteZone) mLauncher.findViewById(R.id.all_apps_delete_zone);
236 allAppsDeleteZone.setDragAndDropEnabled(false);
237 }
238 });
239 resetCheckedGrandchildren();
240 mDragController.removeDropTarget(this);
241 }
242
Winson Chung321e9ee2010-08-09 13:37:56 -0700243 @Override
244 public boolean onLongClick(View v) {
245 if (!v.isInTouchMode()) {
246 return false;
247 }
248
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700249 if (v instanceof Checkable) {
250 // In preparation for drag, we always reset the checked grand children regardless of
251 // what choice mode we are in
252 resetCheckedGrandchildren();
253
254 // Toggle the selection on the dragged app
255 Checkable c = (Checkable) v;
256 c.toggle();
257 }
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700258
Adam Cohencdc30d52010-12-01 15:09:47 -0800259 // Start drag mode after the item is selected
260 setupDragMode();
Patrick Dubroy430c53b2010-09-08 16:01:19 -0700261
Winson Chung321e9ee2010-08-09 13:37:56 -0700262 ApplicationInfo app = (ApplicationInfo) v.getTag();
263 app = new ApplicationInfo(app);
264
Michael Jurkad3ef3062010-11-23 16:23:58 -0800265 // get icon (top compound drawable, index is 1)
266 final Drawable icon = ((TextView) v).getCompoundDrawables()[1];
267 Bitmap b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(),
268 Bitmap.Config.ARGB_8888);
269 Canvas c = new Canvas(b);
270 icon.draw(c);
271 mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, b);
272 mDragController.startDrag(v, b, this, app, DragController.DRAG_ACTION_COPY, null);
Winson Chung321e9ee2010-08-09 13:37:56 -0700273 return true;
274 }
275
276 @Override
Patrick Dubroya669d792010-11-23 14:40:33 -0800277 public void onDragViewVisible() {
278 }
279
280 @Override
Winson Chung321e9ee2010-08-09 13:37:56 -0700281 public void onDropCompleted(View target, boolean success) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700282 // close the choice action mode if we have a proper drop
283 if (target != this) {
284 endChoiceMode();
285 }
Adam Cohencdc30d52010-12-01 15:09:47 -0800286 tearDownDragMode();
Michael Jurka3e7c7632010-10-02 16:01:03 -0700287 mLauncher.getWorkspace().onDragStopped();
Winson Chung321e9ee2010-08-09 13:37:56 -0700288 }
289
290 @Override
291 public boolean isVisible() {
292 return mZoom > 0.001f;
293 }
294
295 @Override
296 public boolean isAnimating() {
297 return (getAnimation() != null);
298 }
299
300 private ArrayList<ApplicationInfo> rebuildFilteredApps(ArrayList<ApplicationInfo> apps) {
301 ArrayList<ApplicationInfo> filteredApps = new ArrayList<ApplicationInfo>();
302 if (mAppFilter == ALL_APPS_FLAG) {
303 return apps;
304 } else {
305 final int length = apps.size();
306 for (int i = 0; i < length; ++i) {
307 ApplicationInfo info = apps.get(i);
308 if ((info.flags & mAppFilter) > 0) {
309 filteredApps.add(info);
310 }
311 }
312 }
313 return filteredApps;
314 }
315
316 @Override
317 public void setApps(ArrayList<ApplicationInfo> list) {
318 mApps = list;
Winson Chung80baf5a2010-08-09 16:03:15 -0700319 Collections.sort(mApps, LauncherModel.APP_NAME_COMPARATOR);
Winson Chung321e9ee2010-08-09 13:37:56 -0700320 mFilteredApps = rebuildFilteredApps(mApps);
Winson Chung241c3b42010-08-25 16:53:03 -0700321 mPageViewIconCache.clear();
Winson Chung321e9ee2010-08-09 13:37:56 -0700322 invalidatePageData();
323 }
324
Winson Chung80baf5a2010-08-09 16:03:15 -0700325 private void addAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
326 // we add it in place, in alphabetical order
327 final int count = list.size();
328 for (int i = 0; i < count; ++i) {
329 final ApplicationInfo info = list.get(i);
330 final int index = Collections.binarySearch(mApps, info, LauncherModel.APP_NAME_COMPARATOR);
331 if (index < 0) {
332 mApps.add(-(index + 1), info);
333 }
334 }
335 mFilteredApps = rebuildFilteredApps(mApps);
336 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700337 @Override
338 public void addApps(ArrayList<ApplicationInfo> list) {
Winson Chung80baf5a2010-08-09 16:03:15 -0700339 addAppsWithoutInvalidate(list);
Winson Chung321e9ee2010-08-09 13:37:56 -0700340 invalidatePageData();
341 }
342
Winson Chung80baf5a2010-08-09 16:03:15 -0700343 private void removeAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
Winson Chung10fefb12010-11-01 11:57:06 -0700344 // End the choice mode if any of the items in the list that are being removed are
345 // currently selected
346 ArrayList<Checkable> checkedList = getCheckedGrandchildren();
347 HashSet<ApplicationInfo> checkedAppInfos = new HashSet<ApplicationInfo>();
348 for (Checkable checked : checkedList) {
349 PagedViewIcon icon = (PagedViewIcon) checked;
350 checkedAppInfos.add((ApplicationInfo) icon.getTag());
351 }
352 for (ApplicationInfo info : list) {
353 if (checkedAppInfos.contains(info)) {
354 endChoiceMode();
355 break;
356 }
357 }
358
359 // Loop through all the apps and remove apps that have the same component
Winson Chung321e9ee2010-08-09 13:37:56 -0700360 final int length = list.size();
361 for (int i = 0; i < length; ++i) {
Winson Chung241c3b42010-08-25 16:53:03 -0700362 final ApplicationInfo info = list.get(i);
363 int removeIndex = findAppByComponent(mApps, info);
Winson Chung321e9ee2010-08-09 13:37:56 -0700364 if (removeIndex > -1) {
365 mApps.remove(removeIndex);
Winson Chung241c3b42010-08-25 16:53:03 -0700366 mPageViewIconCache.removeOutline(info);
Winson Chung321e9ee2010-08-09 13:37:56 -0700367 }
368 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700369 mFilteredApps = rebuildFilteredApps(mApps);
370 }
371 @Override
372 public void removeApps(ArrayList<ApplicationInfo> list) {
373 removeAppsWithoutInvalidate(list);
Winson Chung321e9ee2010-08-09 13:37:56 -0700374 invalidatePageData();
375 }
376
377 @Override
378 public void updateApps(ArrayList<ApplicationInfo> list) {
Winson Chung80baf5a2010-08-09 16:03:15 -0700379 removeAppsWithoutInvalidate(list);
380 addAppsWithoutInvalidate(list);
381 invalidatePageData();
Winson Chung321e9ee2010-08-09 13:37:56 -0700382 }
383
384 private int findAppByComponent(ArrayList<ApplicationInfo> list, ApplicationInfo item) {
385 ComponentName removeComponent = item.intent.getComponent();
386 final int length = list.size();
387 for (int i = 0; i < length; ++i) {
388 ApplicationInfo info = list.get(i);
389 if (info.intent.getComponent().equals(removeComponent)) {
390 return i;
391 }
392 }
393 return -1;
394 }
395
396 @Override
397 public void dumpState() {
398 ApplicationInfo.dumpApplicationInfoList(TAG, "mApps", mApps);
399 }
400
401 @Override
402 public void surrender() {
403 // do nothing?
404 }
405
406 @Override
407 public void syncPages() {
Winson Chung96785572010-10-14 13:37:13 -0700408 // ensure that we have the right number of pages (min of 1, since we have placeholders)
409 int numPages = Math.max(1,
410 (int) Math.ceil((float) mFilteredApps.size() / (mCellCountX * mCellCountY)));
Winson Chung321e9ee2010-08-09 13:37:56 -0700411 int curNumPages = getChildCount();
412 // remove any extra pages after the "last" page
413 int extraPageDiff = curNumPages - numPages;
414 for (int i = 0; i < extraPageDiff; ++i) {
415 removeViewAt(numPages);
416 }
417 // add any necessary pages
418 for (int i = curNumPages; i < numPages; ++i) {
419 PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
420 layout.setCellCount(mCellCountX, mCellCountY);
Winson Chung5ffd8ea2010-09-23 18:40:29 -0700421 layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
422 mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
Winson Chungdf4b83d2010-10-20 17:49:27 -0700423 layout.setGap(mPageLayoutWidthGap, mPageLayoutHeightGap);
Winson Chung321e9ee2010-08-09 13:37:56 -0700424 addView(layout);
425 }
426
427 // bound the current page
Winson Chung86f77532010-08-24 11:08:22 -0700428 setCurrentPage(Math.max(0, Math.min(numPages - 1, getCurrentPage())));
Winson Chung321e9ee2010-08-09 13:37:56 -0700429 }
430
431 @Override
432 public void syncPageItems(int page) {
Winson Chung96785572010-10-14 13:37:13 -0700433 // Ensure that we have the right number of items on the pages
Winson Chung80baf5a2010-08-09 16:03:15 -0700434 final int cellsPerPage = mCellCountX * mCellCountY;
435 final int startIndex = page * cellsPerPage;
436 final int endIndex = Math.min(startIndex + cellsPerPage, mFilteredApps.size());
Winson Chung321e9ee2010-08-09 13:37:56 -0700437 PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(page);
Winson Chung80baf5a2010-08-09 16:03:15 -0700438
Winson Chung96785572010-10-14 13:37:13 -0700439 if (!mFilteredApps.isEmpty()) {
440 int curNumPageItems = layout.getChildCount();
441 int numPageItems = endIndex - startIndex;
Winson Chung80baf5a2010-08-09 16:03:15 -0700442
Winson Chung96785572010-10-14 13:37:13 -0700443 // If we were previously an empty page, then restart anew
444 boolean wasEmptyPage = false;
445 if (curNumPageItems == 1) {
446 View icon = layout.getChildAt(0);
447 if (icon.getTag() == null) {
448 wasEmptyPage = true;
449 }
450 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700451
Winson Chung96785572010-10-14 13:37:13 -0700452 if (wasEmptyPage) {
453 // Remove all the previous items
454 curNumPageItems = 0;
455 layout.removeAllViews();
456 } else {
457 // Remove any extra items
458 int extraPageItemsDiff = curNumPageItems - numPageItems;
459 for (int i = 0; i < extraPageItemsDiff; ++i) {
460 layout.removeViewAt(numPageItems);
461 }
462 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700463
Winson Chung96785572010-10-14 13:37:13 -0700464 // Add any necessary items
465 for (int i = curNumPageItems; i < numPageItems; ++i) {
466 TextView text = (TextView) mInflater.inflate(
467 R.layout.all_apps_paged_view_application, layout, false);
468 text.setOnClickListener(this);
469 text.setOnLongClickListener(this);
Winson Chung321e9ee2010-08-09 13:37:56 -0700470
Winson Chung96785572010-10-14 13:37:13 -0700471 layout.addViewToCellLayout(text, -1, i,
472 new PagedViewCellLayout.LayoutParams(0, 0, 1, 1));
473 }
474
475 // Actually reapply to the existing text views
476 for (int i = startIndex; i < endIndex; ++i) {
477 final int index = i - startIndex;
478 final ApplicationInfo info = mFilteredApps.get(i);
479 PagedViewIcon icon = (PagedViewIcon) layout.getChildAt(index);
Winson Chungdf4b83d2010-10-20 17:49:27 -0700480 icon.applyFromApplicationInfo(info, mPageViewIconCache, true);
Winson Chung96785572010-10-14 13:37:13 -0700481
482 PagedViewCellLayout.LayoutParams params =
483 (PagedViewCellLayout.LayoutParams) icon.getLayoutParams();
484 params.cellX = index % mCellCountX;
485 params.cellY = index / mCellCountX;
486 }
487
488 // Default to left-aligned icons
489 layout.enableCenteredContent(false);
490 } else {
491 // There are no items, so show the user a small message
492 TextView icon = (TextView) mInflater.inflate(
493 R.layout.all_apps_no_items_placeholder, layout, false);
494 switch (mAppFilter) {
Winson Chung96785572010-10-14 13:37:13 -0700495 case ApplicationInfo.DOWNLOADED_FLAG:
496 icon.setText(mContext.getString(R.string.all_apps_no_downloads));
497 break;
498 default: break;
499 }
500
501 // Center-align the message
502 layout.enableCenteredContent(true);
503 layout.removeAllViews();
504 layout.addViewToCellLayout(icon, -1, 0,
505 new PagedViewCellLayout.LayoutParams(0, 0, 2, 1));
Winson Chung321e9ee2010-08-09 13:37:56 -0700506 }
507 }
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700508
509 /*
510 * We don't actually use AllAppsPagedView as a drop target... it's only used to intercept a drop
511 * to the workspace.
512 */
513 @Override
514 public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
515 DragView dragView, Object dragInfo) {
516 return false;
517 }
518 @Override
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700519 public DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset,
520 int yOffset, DragView dragView, Object dragInfo) {
521 return null;
522 }
523 @Override
524 public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
525 DragView dragView, Object dragInfo) {}
526 @Override
527 public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
528 DragView dragView, Object dragInfo) {}
529 @Override
530 public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
531 DragView dragView, Object dragInfo) {}
532 @Override
533 public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
534 DragView dragView, Object dragInfo) {}
Michael Jurka0280c3b2010-09-17 15:00:07 -0700535
536 public boolean isDropEnabled() {
537 return true;
538 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700539}