blob: ecdb7b3f012dc32f98aaabb9a8fa9e79a44f5517 [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
Winson Chung96785572010-10-14 13:37:13 -070019import java.util.ArrayList;
20import java.util.Collections;
Winson Chung10fefb12010-11-01 11:57:06 -070021import java.util.HashSet;
Winson Chung321e9ee2010-08-09 13:37:56 -070022
23import android.content.ComponentName;
24import android.content.Context;
25import android.content.res.TypedArray;
Winson Chung321e9ee2010-08-09 13:37:56 -070026import android.util.AttributeSet;
27import android.view.LayoutInflater;
28import android.view.View;
Winson Chung321e9ee2010-08-09 13:37:56 -070029import android.view.animation.AnimationUtils;
Winson Chung5f2aa4e2010-08-20 14:49:25 -070030import android.widget.Checkable;
Winson Chung321e9ee2010-08-09 13:37:56 -070031import android.widget.TextView;
32
Winson Chung96785572010-10-14 13:37:13 -070033import com.android.launcher.R;
Winson Chung321e9ee2010-08-09 13:37:56 -070034
35/**
36 * An implementation of PagedView that populates the pages of the workspace
37 * with all of the user's applications.
38 */
39public class AllAppsPagedView extends PagedView
Winson Chung5f2aa4e2010-08-20 14:49:25 -070040 implements AllAppsView, View.OnClickListener, View.OnLongClickListener, DragSource,
Adam Cohencdc30d52010-12-01 15:09:47 -080041 DropTarget {
Winson Chung321e9ee2010-08-09 13:37:56 -070042
43 private static final String TAG = "AllAppsPagedView";
44 private static final boolean DEBUG = false;
45
Patrick Dubroy9f7aec82010-09-06 11:03:37 -070046 private static final int MENU_DELETE_APP = 1;
47 private static final int MENU_APP_INFO = 2;
48
Winson Chung321e9ee2010-08-09 13:37:56 -070049 private Launcher mLauncher;
50 private DragController mDragController;
51
52 // preserve compatibility with 3D all apps:
53 // 0.0 -> hidden
54 // 1.0 -> shown and opaque
55 // intermediate values -> partially shown & partially opaque
56 private float mZoom;
57
58 // set of all applications
59 private ArrayList<ApplicationInfo> mApps;
60 private ArrayList<ApplicationInfo> mFilteredApps;
61
62 // the types of applications to filter
63 static final int ALL_APPS_FLAG = -1;
64 private int mAppFilter = ALL_APPS_FLAG;
65
Winson Chung321e9ee2010-08-09 13:37:56 -070066 private final LayoutInflater mInflater;
67
Patrick Dubroydea9e932010-09-22 15:04:29 -070068
Winson Chung321e9ee2010-08-09 13:37:56 -070069 public AllAppsPagedView(Context context) {
70 this(context, null);
71 }
72
73 public AllAppsPagedView(Context context, AttributeSet attrs) {
74 this(context, attrs, 0);
75 }
76
77 public AllAppsPagedView(Context context, AttributeSet attrs, int defStyle) {
78 super(context, attrs, defStyle);
79 TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, defStyle, 0);
80 mCellCountX = a.getInt(R.styleable.PagedView_cellCountX, 6);
81 mCellCountY = a.getInt(R.styleable.PagedView_cellCountY, 4);
82 mInflater = LayoutInflater.from(context);
83 a.recycle();
84 setSoundEffectsEnabled(false);
85 }
86
87 @Override
Winson Chung7da10252010-10-28 16:07:04 -070088 protected void init() {
89 super.init();
90 mCenterPagesVertically = false;
91 }
92
93 @Override
Winson Chung321e9ee2010-08-09 13:37:56 -070094 public void setLauncher(Launcher launcher) {
95 mLauncher = launcher;
Patrick Dubroy2b9ff372010-09-07 17:49:27 -070096 mLauncher.setAllAppsPagedView(this);
Winson Chung321e9ee2010-08-09 13:37:56 -070097 }
98
99 @Override
100 public void setDragController(DragController dragger) {
101 mDragController = dragger;
102 }
103
104 public void setAppFilter(int filterType) {
105 mAppFilter = filterType;
Winson Chung80baf5a2010-08-09 16:03:15 -0700106 if (mApps != null) {
107 mFilteredApps = rebuildFilteredApps(mApps);
Winson Chung86f77532010-08-24 11:08:22 -0700108 setCurrentPage(0);
Winson Chung80baf5a2010-08-09 16:03:15 -0700109 invalidatePageData();
110 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700111 }
112
113 @Override
114 public void zoom(float zoom, boolean animate) {
115 mZoom = zoom;
116 cancelLongPress();
117
118 if (isVisible()) {
119 getParent().bringChildToFront(this);
120 setVisibility(View.VISIBLE);
121 if (animate) {
122 startAnimation(AnimationUtils.loadAnimation(getContext(),
123 R.anim.all_apps_2d_fade_in));
124 } else {
125 onAnimationEnd();
126 }
127 } else {
128 if (animate) {
129 startAnimation(AnimationUtils.loadAnimation(getContext(),
130 R.anim.all_apps_2d_fade_out));
131 } else {
132 onAnimationEnd();
133 }
134 }
135 }
136
137 protected void onAnimationEnd() {
138 if (!isVisible()) {
139 setVisibility(View.GONE);
140 mZoom = 0.0f;
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700141
142 endChoiceMode();
Winson Chung321e9ee2010-08-09 13:37:56 -0700143 } else {
144 mZoom = 1.0f;
145 }
146
147 if (mLauncher != null)
148 mLauncher.zoomed(mZoom);
149 }
150
151 private int getChildIndexForGrandChild(View v) {
152 final int childCount = getChildCount();
153 for (int i = 0; i < childCount; ++i) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700154 final PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(i);
Winson Chung321e9ee2010-08-09 13:37:56 -0700155 if (layout.indexOfChild(v) > -1) {
156 return i;
157 }
158 }
159 return -1;
160 }
161
162 @Override
163 public void onClick(View v) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700164 // if we are already in a choice mode, then just change the selection
165 if (v instanceof Checkable) {
166 if (!isChoiceMode(CHOICE_MODE_NONE)) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700167 Checkable c = (Checkable) v;
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700168 if (isChoiceMode(CHOICE_MODE_SINGLE)) {
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700169 // Uncheck all the other grandchildren, and toggle the clicked one
170 boolean wasChecked = c.isChecked();
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700171 resetCheckedGrandchildren();
Patrick Dubroy9f7aec82010-09-06 11:03:37 -0700172 c.setChecked(!wasChecked);
173 } else {
174 c.toggle();
175 }
176 if (getCheckedGrandchildren().size() == 0) {
177 endChoiceMode();
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700178 }
179
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700180 return;
181 }
182 }
183
184 // otherwise continue and launch the application
Winson Chung321e9ee2010-08-09 13:37:56 -0700185 int childIndex = getChildIndexForGrandChild(v);
Winson Chung86f77532010-08-24 11:08:22 -0700186 if (childIndex == getCurrentPage()) {
Winson Chung321e9ee2010-08-09 13:37:56 -0700187 final ApplicationInfo app = (ApplicationInfo) v.getTag();
188
Winson Chung80baf5a2010-08-09 16:03:15 -0700189 // animate some feedback to the click
190 animateClickFeedback(v, new Runnable() {
Winson Chung321e9ee2010-08-09 13:37:56 -0700191 @Override
Winson Chung80baf5a2010-08-09 16:03:15 -0700192 public void run() {
Winson Chung321e9ee2010-08-09 13:37:56 -0700193 mLauncher.startActivitySafely(app.intent, app);
194 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700195 });
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700196
197 endChoiceMode();
Winson Chung321e9ee2010-08-09 13:37:56 -0700198 }
199 }
200
Adam Cohencdc30d52010-12-01 15:09:47 -0800201 private void setupDragMode() {
202 mLauncher.getWorkspace().shrinkToBottomVisible();
203
204 ApplicationInfoDropTarget infoButton =
205 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
206 infoButton.setDragAndDropEnabled(false);
207 DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
208 deleteZone.setDragAndDropEnabled(false);
209
210 ApplicationInfoDropTarget allAppsInfoButton =
211 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target);
212 allAppsInfoButton.setDragAndDropEnabled(true);
213 DeleteZone allAppsDeleteZone = (DeleteZone)
214 mLauncher.findViewById(R.id.all_apps_delete_zone);
215 allAppsDeleteZone.setDragAndDropEnabled(true);
216 }
217
218 private void tearDownDragMode() {
219 post(new Runnable() {
220 // Once the drag operation has fully completed, hence the post, we want to disable the
221 // deleteZone and the appInfoButton in all apps, and re-enable the instance which
222 // live in the workspace
223 public void run() {
224 ApplicationInfoDropTarget infoButton =
225 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.info_button);
226 infoButton.setDragAndDropEnabled(true);
227 DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
228 deleteZone.setDragAndDropEnabled(true);
229
230 ApplicationInfoDropTarget allAppsInfoButton =
231 (ApplicationInfoDropTarget) mLauncher.findViewById(R.id.all_apps_info_target);
232 allAppsInfoButton.setDragAndDropEnabled(false);
233 DeleteZone allAppsDeleteZone =
234 (DeleteZone) mLauncher.findViewById(R.id.all_apps_delete_zone);
235 allAppsDeleteZone.setDragAndDropEnabled(false);
236 }
237 });
238 resetCheckedGrandchildren();
239 mDragController.removeDropTarget(this);
240 }
241
Winson Chung321e9ee2010-08-09 13:37:56 -0700242 @Override
243 public boolean onLongClick(View v) {
244 if (!v.isInTouchMode()) {
245 return false;
246 }
247
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700248 if (v instanceof Checkable) {
249 // In preparation for drag, we always reset the checked grand children regardless of
250 // what choice mode we are in
251 resetCheckedGrandchildren();
252
253 // Toggle the selection on the dragged app
254 Checkable c = (Checkable) v;
255 c.toggle();
256 }
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700257
Adam Cohencdc30d52010-12-01 15:09:47 -0800258 // Start drag mode after the item is selected
259 setupDragMode();
Patrick Dubroy430c53b2010-09-08 16:01:19 -0700260
Winson Chung321e9ee2010-08-09 13:37:56 -0700261 ApplicationInfo app = (ApplicationInfo) v.getTag();
262 app = new ApplicationInfo(app);
263
Michael Jurka3e7c7632010-10-02 16:01:03 -0700264 mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1);
Winson Chung321e9ee2010-08-09 13:37:56 -0700265 mDragController.startDrag(v, this, app, DragController.DRAG_ACTION_COPY);
Winson Chung321e9ee2010-08-09 13:37:56 -0700266 return true;
267 }
268
269 @Override
Patrick Dubroya669d792010-11-23 14:40:33 -0800270 public void onDragViewVisible() {
271 }
272
273 @Override
Winson Chung321e9ee2010-08-09 13:37:56 -0700274 public void onDropCompleted(View target, boolean success) {
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700275 // close the choice action mode if we have a proper drop
276 if (target != this) {
277 endChoiceMode();
278 }
Adam Cohencdc30d52010-12-01 15:09:47 -0800279 tearDownDragMode();
Michael Jurka3e7c7632010-10-02 16:01:03 -0700280 mLauncher.getWorkspace().onDragStopped();
Winson Chung321e9ee2010-08-09 13:37:56 -0700281 }
282
283 @Override
284 public boolean isVisible() {
285 return mZoom > 0.001f;
286 }
287
288 @Override
289 public boolean isAnimating() {
290 return (getAnimation() != null);
291 }
292
293 private ArrayList<ApplicationInfo> rebuildFilteredApps(ArrayList<ApplicationInfo> apps) {
294 ArrayList<ApplicationInfo> filteredApps = new ArrayList<ApplicationInfo>();
295 if (mAppFilter == ALL_APPS_FLAG) {
296 return apps;
297 } else {
298 final int length = apps.size();
299 for (int i = 0; i < length; ++i) {
300 ApplicationInfo info = apps.get(i);
301 if ((info.flags & mAppFilter) > 0) {
302 filteredApps.add(info);
303 }
304 }
305 }
306 return filteredApps;
307 }
308
309 @Override
310 public void setApps(ArrayList<ApplicationInfo> list) {
311 mApps = list;
Winson Chung80baf5a2010-08-09 16:03:15 -0700312 Collections.sort(mApps, LauncherModel.APP_NAME_COMPARATOR);
Winson Chung321e9ee2010-08-09 13:37:56 -0700313 mFilteredApps = rebuildFilteredApps(mApps);
Winson Chung241c3b42010-08-25 16:53:03 -0700314 mPageViewIconCache.clear();
Winson Chung321e9ee2010-08-09 13:37:56 -0700315 invalidatePageData();
316 }
317
Winson Chung80baf5a2010-08-09 16:03:15 -0700318 private void addAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
319 // we add it in place, in alphabetical order
320 final int count = list.size();
321 for (int i = 0; i < count; ++i) {
322 final ApplicationInfo info = list.get(i);
323 final int index = Collections.binarySearch(mApps, info, LauncherModel.APP_NAME_COMPARATOR);
324 if (index < 0) {
325 mApps.add(-(index + 1), info);
326 }
327 }
328 mFilteredApps = rebuildFilteredApps(mApps);
329 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700330 @Override
331 public void addApps(ArrayList<ApplicationInfo> list) {
Winson Chung80baf5a2010-08-09 16:03:15 -0700332 addAppsWithoutInvalidate(list);
Winson Chung321e9ee2010-08-09 13:37:56 -0700333 invalidatePageData();
334 }
335
Winson Chung80baf5a2010-08-09 16:03:15 -0700336 private void removeAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) {
Winson Chung10fefb12010-11-01 11:57:06 -0700337 // End the choice mode if any of the items in the list that are being removed are
338 // currently selected
339 ArrayList<Checkable> checkedList = getCheckedGrandchildren();
340 HashSet<ApplicationInfo> checkedAppInfos = new HashSet<ApplicationInfo>();
341 for (Checkable checked : checkedList) {
342 PagedViewIcon icon = (PagedViewIcon) checked;
343 checkedAppInfos.add((ApplicationInfo) icon.getTag());
344 }
345 for (ApplicationInfo info : list) {
346 if (checkedAppInfos.contains(info)) {
347 endChoiceMode();
348 break;
349 }
350 }
351
352 // Loop through all the apps and remove apps that have the same component
Winson Chung321e9ee2010-08-09 13:37:56 -0700353 final int length = list.size();
354 for (int i = 0; i < length; ++i) {
Winson Chung241c3b42010-08-25 16:53:03 -0700355 final ApplicationInfo info = list.get(i);
356 int removeIndex = findAppByComponent(mApps, info);
Winson Chung321e9ee2010-08-09 13:37:56 -0700357 if (removeIndex > -1) {
358 mApps.remove(removeIndex);
Winson Chung241c3b42010-08-25 16:53:03 -0700359 mPageViewIconCache.removeOutline(info);
Winson Chung321e9ee2010-08-09 13:37:56 -0700360 }
361 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700362 mFilteredApps = rebuildFilteredApps(mApps);
363 }
364 @Override
365 public void removeApps(ArrayList<ApplicationInfo> list) {
366 removeAppsWithoutInvalidate(list);
Winson Chung321e9ee2010-08-09 13:37:56 -0700367 invalidatePageData();
368 }
369
370 @Override
371 public void updateApps(ArrayList<ApplicationInfo> list) {
Winson Chung80baf5a2010-08-09 16:03:15 -0700372 removeAppsWithoutInvalidate(list);
373 addAppsWithoutInvalidate(list);
374 invalidatePageData();
Winson Chung321e9ee2010-08-09 13:37:56 -0700375 }
376
377 private int findAppByComponent(ArrayList<ApplicationInfo> list, ApplicationInfo item) {
378 ComponentName removeComponent = item.intent.getComponent();
379 final int length = list.size();
380 for (int i = 0; i < length; ++i) {
381 ApplicationInfo info = list.get(i);
382 if (info.intent.getComponent().equals(removeComponent)) {
383 return i;
384 }
385 }
386 return -1;
387 }
388
389 @Override
390 public void dumpState() {
391 ApplicationInfo.dumpApplicationInfoList(TAG, "mApps", mApps);
392 }
393
394 @Override
395 public void surrender() {
396 // do nothing?
397 }
398
399 @Override
400 public void syncPages() {
Winson Chung96785572010-10-14 13:37:13 -0700401 // ensure that we have the right number of pages (min of 1, since we have placeholders)
402 int numPages = Math.max(1,
403 (int) Math.ceil((float) mFilteredApps.size() / (mCellCountX * mCellCountY)));
Winson Chung321e9ee2010-08-09 13:37:56 -0700404 int curNumPages = getChildCount();
405 // remove any extra pages after the "last" page
406 int extraPageDiff = curNumPages - numPages;
407 for (int i = 0; i < extraPageDiff; ++i) {
408 removeViewAt(numPages);
409 }
410 // add any necessary pages
411 for (int i = curNumPages; i < numPages; ++i) {
412 PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
413 layout.setCellCount(mCellCountX, mCellCountY);
Winson Chung5ffd8ea2010-09-23 18:40:29 -0700414 layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
415 mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
Winson Chungdf4b83d2010-10-20 17:49:27 -0700416 layout.setGap(mPageLayoutWidthGap, mPageLayoutHeightGap);
Winson Chung321e9ee2010-08-09 13:37:56 -0700417 addView(layout);
418 }
419
420 // bound the current page
Winson Chung86f77532010-08-24 11:08:22 -0700421 setCurrentPage(Math.max(0, Math.min(numPages - 1, getCurrentPage())));
Winson Chung321e9ee2010-08-09 13:37:56 -0700422 }
423
424 @Override
425 public void syncPageItems(int page) {
Winson Chung96785572010-10-14 13:37:13 -0700426 // Ensure that we have the right number of items on the pages
Winson Chung80baf5a2010-08-09 16:03:15 -0700427 final int cellsPerPage = mCellCountX * mCellCountY;
428 final int startIndex = page * cellsPerPage;
429 final int endIndex = Math.min(startIndex + cellsPerPage, mFilteredApps.size());
Winson Chung321e9ee2010-08-09 13:37:56 -0700430 PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(page);
Winson Chung80baf5a2010-08-09 16:03:15 -0700431
Winson Chung96785572010-10-14 13:37:13 -0700432 if (!mFilteredApps.isEmpty()) {
433 int curNumPageItems = layout.getChildCount();
434 int numPageItems = endIndex - startIndex;
Winson Chung80baf5a2010-08-09 16:03:15 -0700435
Winson Chung96785572010-10-14 13:37:13 -0700436 // If we were previously an empty page, then restart anew
437 boolean wasEmptyPage = false;
438 if (curNumPageItems == 1) {
439 View icon = layout.getChildAt(0);
440 if (icon.getTag() == null) {
441 wasEmptyPage = true;
442 }
443 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700444
Winson Chung96785572010-10-14 13:37:13 -0700445 if (wasEmptyPage) {
446 // Remove all the previous items
447 curNumPageItems = 0;
448 layout.removeAllViews();
449 } else {
450 // Remove any extra items
451 int extraPageItemsDiff = curNumPageItems - numPageItems;
452 for (int i = 0; i < extraPageItemsDiff; ++i) {
453 layout.removeViewAt(numPageItems);
454 }
455 }
Winson Chung80baf5a2010-08-09 16:03:15 -0700456
Winson Chung96785572010-10-14 13:37:13 -0700457 // Add any necessary items
458 for (int i = curNumPageItems; i < numPageItems; ++i) {
459 TextView text = (TextView) mInflater.inflate(
460 R.layout.all_apps_paged_view_application, layout, false);
461 text.setOnClickListener(this);
462 text.setOnLongClickListener(this);
Winson Chung321e9ee2010-08-09 13:37:56 -0700463
Winson Chung96785572010-10-14 13:37:13 -0700464 layout.addViewToCellLayout(text, -1, i,
465 new PagedViewCellLayout.LayoutParams(0, 0, 1, 1));
466 }
467
468 // Actually reapply to the existing text views
469 for (int i = startIndex; i < endIndex; ++i) {
470 final int index = i - startIndex;
471 final ApplicationInfo info = mFilteredApps.get(i);
472 PagedViewIcon icon = (PagedViewIcon) layout.getChildAt(index);
Winson Chungdf4b83d2010-10-20 17:49:27 -0700473 icon.applyFromApplicationInfo(info, mPageViewIconCache, true);
Winson Chung96785572010-10-14 13:37:13 -0700474
475 PagedViewCellLayout.LayoutParams params =
476 (PagedViewCellLayout.LayoutParams) icon.getLayoutParams();
477 params.cellX = index % mCellCountX;
478 params.cellY = index / mCellCountX;
479 }
480
481 // Default to left-aligned icons
482 layout.enableCenteredContent(false);
483 } else {
484 // There are no items, so show the user a small message
485 TextView icon = (TextView) mInflater.inflate(
486 R.layout.all_apps_no_items_placeholder, layout, false);
487 switch (mAppFilter) {
Winson Chung96785572010-10-14 13:37:13 -0700488 case ApplicationInfo.DOWNLOADED_FLAG:
489 icon.setText(mContext.getString(R.string.all_apps_no_downloads));
490 break;
491 default: break;
492 }
493
494 // Center-align the message
495 layout.enableCenteredContent(true);
496 layout.removeAllViews();
497 layout.addViewToCellLayout(icon, -1, 0,
498 new PagedViewCellLayout.LayoutParams(0, 0, 2, 1));
Winson Chung321e9ee2010-08-09 13:37:56 -0700499 }
500 }
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700501
502 /*
503 * We don't actually use AllAppsPagedView as a drop target... it's only used to intercept a drop
504 * to the workspace.
505 */
506 @Override
507 public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
508 DragView dragView, Object dragInfo) {
509 return false;
510 }
511 @Override
Winson Chung5f2aa4e2010-08-20 14:49:25 -0700512 public DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset,
513 int yOffset, DragView dragView, Object dragInfo) {
514 return null;
515 }
516 @Override
517 public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
518 DragView dragView, Object dragInfo) {}
519 @Override
520 public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
521 DragView dragView, Object dragInfo) {}
522 @Override
523 public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
524 DragView dragView, Object dragInfo) {}
525 @Override
526 public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
527 DragView dragView, Object dragInfo) {}
Michael Jurka0280c3b2010-09-17 15:00:07 -0700528
529 public boolean isDropEnabled() {
530 return true;
531 }
Winson Chung321e9ee2010-08-09 13:37:56 -0700532}